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.- Version:
- $Revision: 1.4 $, $Date: 2007/05/05 05:32:20 $
- Author:
- Dan Sandberg, David Becker
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classSSIServletExternalResolver.ServletContextAndPath
-
Field Summary
Fields Modifier and Type Field Description protected jakarta.servlet.ServletContextcontextprotected intdebugprotected StringinputEncodingprotected booleanisVirtualWebappRelativeprotected jakarta.servlet.http.HttpServletRequestreqprotected jakarta.servlet.http.HttpServletResponseresprotected String[]VARIABLE_NAMES
-
Constructor Summary
Constructors Constructor Description SSIServletExternalResolver(jakarta.servlet.ServletContext context, jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res, boolean isVirtualWebappRelative, int debug, String inputEncoding)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddVariableNames(Collection<String> variableNames)Adds any external variables to the variableNames collection.protected StringgetAbsolutePath(String path)protected StringgetCGIVariable(String name)DategetCurrentDate()Returns the current date.longgetFileLastModified(String path, boolean virtual)longgetFileSize(String path, boolean virtual)StringgetFileText(String originalPath, boolean virtual)protected StringgetPathWithoutContext(String contextPath, String servletPath)protected StringgetPathWithoutFileName(String servletPath)protected ObjectgetReqAttributeIgnoreCase(String targetName)protected SSIServletExternalResolver.ServletContextAndPathgetServletContextAndPath(String originalPath, boolean virtual)protected SSIServletExternalResolver.ServletContextAndPathgetServletContextAndPathFromNonVirtualPath(String nonVirtualPath)protected SSIServletExternalResolver.ServletContextAndPathgetServletContextAndPathFromVirtualPath(String virtualPath)protected URLConnectiongetURLConnection(String originalPath, boolean virtual)StringgetVariableValue(String name)protected booleanisNameReserved(String name)protected booleanisRootContext(jakarta.servlet.ServletContext servletContext)voidlog(String message, Throwable throwable)protected StringnullToEmptyString(String string)voidsetVariableValue(String name, String value)Set the named variable to the specified value.
-
-
-
Field Detail
-
VARIABLE_NAMES
protected final String[] VARIABLE_NAMES
-
context
protected jakarta.servlet.ServletContext context
-
req
protected jakarta.servlet.http.HttpServletRequest req
-
res
protected jakarta.servlet.http.HttpServletResponse res
-
isVirtualWebappRelative
protected boolean isVirtualWebappRelative
-
debug
protected int debug
-
inputEncoding
protected String inputEncoding
-
-
Constructor Detail
-
SSIServletExternalResolver
public SSIServletExternalResolver(jakarta.servlet.ServletContext context, jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res, boolean isVirtualWebappRelative, int debug, String inputEncoding)
-
-
Method Detail
-
log
public void log(String message, Throwable throwable)
- Specified by:
login interfaceSSIExternalResolver
-
addVariableNames
public void addVariableNames(Collection<String> variableNames)
Description copied from interface:SSIExternalResolverAdds any external variables to the variableNames collection.- Specified by:
addVariableNamesin 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:SSIExternalResolverSet 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:
setVariableValuein interfaceSSIExternalResolver- Parameters:
name- of the variablevalue- of the variable
-
getVariableValue
public String getVariableValue(String name)
- Specified by:
getVariableValuein interfaceSSIExternalResolver
-
getCurrentDate
public Date getCurrentDate()
Description copied from interface:SSIExternalResolverReturns 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:
getCurrentDatein 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(jakarta.servlet.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:
getFileLastModifiedin interfaceSSIExternalResolver- Throws:
IOException
-
getFileSize
public long getFileSize(String path, boolean virtual) throws IOException
- Specified by:
getFileSizein interfaceSSIExternalResolver- Throws:
IOException
-
getFileText
public String getFileText(String originalPath, boolean virtual) throws IOException
- Specified by:
getFileTextin interfaceSSIExternalResolver- Throws:
IOException
-
-