Class SSIProcessor
java.lang.Object
org.apache.catalina.ssi.SSIProcessor
The entry point to SSI processing. This class does the actual parsing, delegating to the SSIMediator, SSICommand, and
SSIExternalResolver as necessary.
- Author:
- Dan Sandberg, David Becker
-
Field Summary
Modifier and TypeFieldDescriptionprotected final boolean
protected static final String
The end patternprotected static final String
The start patternprotected final HashMap
<String, SSICommand> protected final int
protected final SSIExternalResolver
-
Constructor Summary
ConstructorDescriptionSSIProcessor
(SSIExternalResolver ssiExternalResolver, int debug, boolean allowExec) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
void
addCommand
(String name, SSICommand command) protected boolean
protected boolean
isQuote
(char c) protected boolean
isSpace
(char c) protected String[]
parseParamNames
(StringBuilder cmd, int start) Parse a StringBuilder and take out the param type token.protected String[]
parseParamValues
(StringBuilder cmd, int start, int count) Parse a StringBuilder and take out the param token.long
process
(Reader reader, long lastModifiedDate, PrintWriter writer) Process a file with server-side commands, reading from reader and writing the processed version to writer.
-
Field Details
-
COMMAND_START
-
COMMAND_END
-
ssiExternalResolver
-
commands
-
debug
protected final int debug -
allowExec
protected final boolean allowExec
-
-
Constructor Details
-
SSIProcessor
-
-
Method Details
-
addBuiltinCommands
protected void addBuiltinCommands() -
addCommand
-
process
Process a file with server-side commands, reading from reader and writing the processed version to writer. NOTE: We really should be doing this in a streaming way rather than converting it to an array first.- Parameters:
reader
- the reader to read the file containing SSIs fromlastModifiedDate
- resource last modification datewriter
- the writer to write the file with the SSIs processed.- Returns:
- the most current modified date resulting from any SSI commands
- Throws:
IOException
- when things go horribly awry. Should be unlikely since the SSICommand usually catches 'normal' IOExceptions.
-
parseParamNames
Parse a StringBuilder and take out the param type token. Called fromrequestHandler
- Parameters:
cmd
- a value of type 'StringBuilder'start
- index on which parsing will start- Returns:
- an array with the parameter names
-
parseParamValues
Parse a StringBuilder and take out the param token. Called fromrequestHandler
- Parameters:
cmd
- a value of type 'StringBuilder'start
- index on which parsing will startcount
- number of values which should be parsed- Returns:
- an array with the parameter values
-
charCmp
-
isSpace
protected boolean isSpace(char c) -
isQuote
protected boolean isQuote(char c)
-