Class SSIServletExternalResolver
java.lang.Object
org.apache.catalina.ssi.SSIServletExternalResolver
- All Implemented Interfaces:
SSIExternalResolver
An implementation of SSIExternalResolver that is used with servlets.
- Author:
- Dan Sandberg, David Becker
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
-
Field Summary
Modifier and TypeFieldDescriptionprotected final ServletContext
protected final int
protected final String
protected final boolean
protected final HttpServletRequest
protected final HttpServletResponse
protected final String[]
-
Constructor Summary
ConstructorDescriptionSSIServletExternalResolver
(ServletContext context, HttpServletRequest req, HttpServletResponse res, boolean isVirtualWebappRelative, int debug, String inputEncoding) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addVariableNames
(Collection<String> variableNames) Adds any external variables to the variableNames collection.protected String
getAbsolutePath
(String path) protected String
getCGIVariable
(String name) Returns the current date.long
getFileLastModified
(String path, boolean virtual) long
getFileSize
(String path, boolean virtual) getFileText
(String originalPath, boolean virtual) protected String
getPathWithoutContext
(String contextPath, String servletPath) protected String
getPathWithoutFileName
(String servletPath) protected Object
getReqAttributeIgnoreCase
(String targetName) getServletContextAndPath
(String originalPath, boolean virtual) getServletContextAndPathFromNonVirtualPath
(String nonVirtualPath) getServletContextAndPathFromVirtualPath
(String virtualPath) protected URLConnection
getURLConnection
(String originalPath, boolean virtual) getVariableValue
(String name) protected boolean
isNameReserved
(String name) protected boolean
isRootContext
(ServletContext servletContext) void
protected String
nullToEmptyString
(String string) void
setVariableValue
(String name, String value) Set the named variable to the specified value.
-
Field Details
-
VARIABLE_NAMES
-
context
-
req
-
res
-
isVirtualWebappRelative
protected final boolean isVirtualWebappRelative -
debug
protected final int debug -
inputEncoding
-
-
Constructor Details
-
SSIServletExternalResolver
public SSIServletExternalResolver(ServletContext context, HttpServletRequest req, HttpServletResponse res, boolean isVirtualWebappRelative, int debug, String inputEncoding)
-
-
Method Details
-
log
- Specified by:
log
in interfaceSSIExternalResolver
-
addVariableNames
Description copied from interface:SSIExternalResolver
Adds any external variables to the variableNames collection.- Specified by:
addVariableNames
in interfaceSSIExternalResolver
- Parameters:
variableNames
- the collection to add to
-
getReqAttributeIgnoreCase
-
isNameReserved
-
setVariableValue
Description copied from interface:SSIExternalResolver
Set the named variable to the specified value. If value is null, then the variable will be removed ( ie. a call to getVariableValue will return null )- Specified by:
setVariableValue
in interfaceSSIExternalResolver
- Parameters:
name
- of the variablevalue
- of the variable
-
getVariableValue
- Specified by:
getVariableValue
in interfaceSSIExternalResolver
-
getCGIVariable
-
getCurrentDate
Description copied from interface:SSIExternalResolver
Returns the current date. This is useful for putting the SSI stuff in a regression test. Since you can make the current date a constant, it makes testing easier since the output won't change.- Specified by:
getCurrentDate
in interfaceSSIExternalResolver
- Returns:
- the data
-
nullToEmptyString
-
getPathWithoutFileName
-
getPathWithoutContext
-
getAbsolutePath
- Throws:
IOException
-
getServletContextAndPathFromNonVirtualPath
protected SSIServletExternalResolver.ServletContextAndPath getServletContextAndPathFromNonVirtualPath(String nonVirtualPath) throws IOException - Throws:
IOException
-
getServletContextAndPathFromVirtualPath
protected SSIServletExternalResolver.ServletContextAndPath getServletContextAndPathFromVirtualPath(String virtualPath) throws IOException - Throws:
IOException
-
isRootContext
-
getServletContextAndPath
protected SSIServletExternalResolver.ServletContextAndPath getServletContextAndPath(String originalPath, boolean virtual) throws IOException - Throws:
IOException
-
getURLConnection
- Throws:
IOException
-
getFileLastModified
- Specified by:
getFileLastModified
in interfaceSSIExternalResolver
- Throws:
IOException
-
getFileSize
- Specified by:
getFileSize
in interfaceSSIExternalResolver
- Throws:
IOException
-
getFileText
- Specified by:
getFileText
in interfaceSSIExternalResolver
- Throws:
IOException
-