SSIServletExternalResolver (Apache Tomcat 11.0.22 API Documentation)
Description: declaration: package: org.apache.catalina.ssi, class: SSIServletExternalResolver

# 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.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `protected static final record`
  `SSIServletExternalResolver.ServletContextAndPath`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected final ServletContext`
  `context`
  `protected final int`
  `debug`
  `protected final String`
  `inputEncoding`
  `protected final boolean`
  `isVirtualWebappRelative`
  `protected final HttpServletRequest`
  `req`
  `protected final HttpServletResponse`
  `res`
  `protected final String[]`
  `VARIABLE_NAMES`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SSIServletExternalResolver(ServletContext context, HttpServletRequest req, HttpServletResponse res, boolean isVirtualWebappRelative, int debug, String inputEncoding)`

- ## Method Summary

  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(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.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### 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 Details

  - ### SSIServletExternalResolver

    public SSIServletExternalResolver(ServletContext context, HttpServletRequest req, HttpServletResponse res, boolean isVirtualWebappRelative, int debug, String inputEncoding)

- ## Method Details

  - ### log

    public void log(String message, Throwable throwable)
    Specified by:
      `log` in interface `SSIExternalResolver`

  - ### addVariableNames

    public void addVariableNames(Collection<String> variableNames)
    Description copied from interface: `SSIExternalResolver`
    Adds any external variables to the variableNames collection.
    Specified by:
      `addVariableNames` in interface `SSIExternalResolver`
    Parameters:
      `variableNames` - the collection to add to

  - ### getReqAttributeIgnoreCase

    protected Object getReqAttributeIgnoreCase(String targetName)

  - ### 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 interface `SSIExternalResolver`
    Parameters:
      `name` - of the variable
      `value` - of the variable

  - ### getVariableValue

    public String getVariableValue(String name)
    Specified by:
      `getVariableValue` in interface `SSIExternalResolver`

  - ### getCGIVariable

    protected String getCGIVariable(String name)

  - ### 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 interface `SSIExternalResolver`
    Returns:
      the data

  - ### nullToEmptyString

    protected String nullToEmptyString(String string)

  - ### getPathWithoutFileName

    protected String getPathWithoutFileName(String servletPath)

  - ### 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 interface `SSIExternalResolver`
    Throws:
      `IOException`

  - ### getFileSize

    public long getFileSize(String path, boolean virtual) throws IOException
    Specified by:
      `getFileSize` in interface `SSIExternalResolver`
    Throws:
      `IOException`

  - ### getFileText

    public String getFileText(String originalPath, boolean virtual) throws IOException
    Specified by:
      `getFileText` in interface `SSIExternalResolver`
    Throws:
      `IOException`