# Class SSIFilter

java.lang.Object
jakarta.servlet.GenericFilter
org.apache.catalina.ssi.SSIFilter

All Implemented Interfaces:
  `Filter, FilterConfig, Serializable`

public class SSIFilter extends GenericFilter
Filter to process SSI requests within a webpage. Mapped to a content types from within web.xml.

See Also:
  - `SSIServlet`
  - Serialized Form

## Field Summary

Fields
Modifier and Type
Field
Description
`protected boolean`
`allowExec`
When true, allows the exec directive (normally blocked for security).
`protected Pattern`
`contentTypeRegEx`
Regex pattern to match when evaluating content types for SSI processing.
`protected int`
`debug`
Debug level for this servlet.
`protected Long`
`expires`
Expiration time in seconds for the doc.
`protected boolean`
`isVirtualWebappRelative`
When true, virtual paths are interpreted as webapp-relative.
`protected final Pattern`
`shtmlRegEx`
Default pattern for matching SHTML content type.

## Constructor Summary

Constructors
Constructor
Description
`SSIFilter()`
Default constructor.

## Method Summary

Modifier and Type
Method
Description
`void`
`doFilter(ServletRequest request, ServletResponse response, FilterChain chain)`
Captures the response, processes SSI directives if the content type matches, and writes the output.
`void`
`init()`
Initializes the filter by reading configuration parameters.

### Methods inherited from class GenericFilter

`getFilterConfig, getFilterName, getInitParameter, getInitParameterNames, getServletContext, init`

### Methods inherited from class Object

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

### Methods inherited from interface Filter

`destroy`

## Field Details

### debug

protected int debug
Debug level for this servlet.

### expires

protected Long expires
Expiration time in seconds for the doc.

### isVirtualWebappRelative

protected boolean isVirtualWebappRelative
When true, virtual paths are interpreted as webapp-relative.

### contentTypeRegEx

protected Pattern contentTypeRegEx
Regex pattern to match when evaluating content types for SSI processing.

### shtmlRegEx

protected final Pattern shtmlRegEx
Default pattern for matching SHTML content type.

### allowExec

protected boolean allowExec
When true, allows the exec directive (normally blocked for security).

## Constructor Details

### SSIFilter

public SSIFilter()
Default constructor.

## Method Details

### init

public void init() throws ServletException
Initializes the filter by reading configuration parameters.

Overrides:
  `init` in class `GenericFilter`
Throws:
  `ServletException` - If an exception occurs that interrupts the Filter's normal operation

### doFilter

public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException
Captures the response, processes SSI directives if the content type matches, and writes the output.

Parameters:
  `request` - The request to process
  `response` - The response associated with the request
  `chain` - Provides access to the next filter in the chain for this filter to pass the request and response to for further processing
Throws:
  `IOException` - if an I/O error occurs during this filter's processing of the request
  `ServletException` - if the processing fails for any other reason