Package org.apache.catalina.ssi
Class SSIServletExternalResolver
- java.lang.Object
-
- org.apache.catalina.ssi.SSIServletExternalResolver
-
- All Implemented Interfaces:
SSIExternalResolver
public class SSIServletExternalResolver extends Object implements SSIExternalResolver
An implementation of SSIExternalResolver that is used with servlets.- Author:
- Dan Sandberg, David Becker
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
SSIServletExternalResolver.ServletContextAndPath
-
Field Summary
Fields Modifier and Type Field Description protected ServletContext
context
protected int
debug
protected String
inputEncoding
protected boolean
isVirtualWebappRelative
protected HttpServletRequest
req
protected HttpServletResponse
res
protected String[]
VARIABLE_NAMES
-
Constructor Summary
Constructors Constructor Description SSIServletExternalResolver(ServletContext context, HttpServletRequest req, HttpServletResponse res, boolean isVirtualWebappRelative, int debug, String inputEncoding)
-
Method Summary
-
-
-
Field Detail
-
VARIABLE_NAMES
protected final String[] VARIABLE_NAMES
-
context
protected final ServletContext context
-
req
protected final HttpServletRequest req
-
res
protected final HttpServletResponse res
-
isVirtualWebappRelative
protected final boolean isVirtualWebappRelative
-
debug
protected final int debug
-
inputEncoding
protected final String inputEncoding
-
-
Constructor Detail
-
SSIServletExternalResolver
public SSIServletExternalResolver(ServletContext context, HttpServletRequest req, HttpServletResponse res, boolean isVirtualWebappRelative, int debug, String inputEncoding)
-
-
Method Detail
-
log
public void log(String message, Throwable throwable)
- Specified by:
log
in interfaceSSIExternalResolver
-
addVariableNames
public void addVariableNames(Collection<String> variableNames)
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
-
isNameReserved
protected boolean isNameReserved(String name)
-
setVariableValue
public void setVariableValue(String name, String value)
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
public String getVariableValue(String name)
- Specified by:
getVariableValue
in interfaceSSIExternalResolver
-
getCurrentDate
public Date 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
-
getPathWithoutContext
protected String getPathWithoutContext(String contextPath, String servletPath)
-
getAbsolutePath
protected String getAbsolutePath(String path) throws IOException
- 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
protected boolean isRootContext(ServletContext servletContext)
-
getServletContextAndPath
protected SSIServletExternalResolver.ServletContextAndPath getServletContextAndPath(String originalPath, boolean virtual) throws IOException
- Throws:
IOException
-
getURLConnection
protected URLConnection getURLConnection(String originalPath, boolean virtual) throws IOException
- Throws:
IOException
-
getFileLastModified
public long getFileLastModified(String path, boolean virtual) throws IOException
- Specified by:
getFileLastModified
in interfaceSSIExternalResolver
- Throws:
IOException
-
getFileSize
public long getFileSize(String path, boolean virtual) throws IOException
- Specified by:
getFileSize
in interfaceSSIExternalResolver
- Throws:
IOException
-
getFileText
public String getFileText(String originalPath, boolean virtual) throws IOException
- Specified by:
getFileText
in interfaceSSIExternalResolver
- Throws:
IOException
-
-