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 class
SSIServletExternalResolver.ServletContextAndPath
-
Field Summary
Fields Modifier and Type Field Description protected jakarta.servlet.ServletContext
context
protected int
debug
protected String
inputEncoding
protected boolean
isVirtualWebappRelative
protected jakarta.servlet.http.HttpServletRequest
req
protected jakarta.servlet.http.HttpServletResponse
res
protected 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 void
addVariableNames(Collection<String> variableNames)
Adds any external variables to the variableNames collection.protected String
getAbsolutePath(String path)
protected String
getCGIVariable(String name)
Date
getCurrentDate()
Returns the current date.long
getFileLastModified(String path, boolean virtual)
long
getFileSize(String path, boolean virtual)
String
getFileText(String originalPath, boolean virtual)
protected String
getPathWithoutContext(String contextPath, String servletPath)
protected String
getPathWithoutFileName(String servletPath)
protected Object
getReqAttributeIgnoreCase(String targetName)
protected SSIServletExternalResolver.ServletContextAndPath
getServletContextAndPath(String originalPath, boolean virtual)
protected SSIServletExternalResolver.ServletContextAndPath
getServletContextAndPathFromNonVirtualPath(String nonVirtualPath)
protected SSIServletExternalResolver.ServletContextAndPath
getServletContextAndPathFromVirtualPath(String virtualPath)
protected URLConnection
getURLConnection(String originalPath, boolean virtual)
String
getVariableValue(String name)
protected boolean
isNameReserved(String name)
protected boolean
isRootContext(jakarta.servlet.ServletContext servletContext)
void
log(String message, Throwable throwable)
protected String
nullToEmptyString(String string)
void
setVariableValue(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:
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(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:
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
-
-