Package org.apache.catalina.ssi
Class SSIProcessor
- java.lang.Object
- 
- org.apache.catalina.ssi.SSIProcessor
 
- 
 public class SSIProcessor extends java.lang.ObjectThe 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 SummaryFields Modifier and Type Field Description protected booleanallowExecprotected static java.lang.StringCOMMAND_ENDThe end patternprotected static java.lang.StringCOMMAND_STARTThe start patternprotected java.util.HashMap<java.lang.String,SSICommand>commandsprotected intdebugprotected SSIExternalResolverssiExternalResolver
 - 
Constructor SummaryConstructors Constructor Description SSIProcessor(SSIExternalResolver ssiExternalResolver, int debug, boolean allowExec)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddBuiltinCommands()voidaddCommand(java.lang.String name, SSICommand command)protected booleancharCmp(java.lang.String buf, int index, java.lang.String command)protected booleanisQuote(char c)protected booleanisSpace(char c)protected java.lang.String[]parseParamNames(java.lang.StringBuilder cmd, int start)Parse a StringBuilder and take out the param type token.protected java.lang.String[]parseParamValues(java.lang.StringBuilder cmd, int start, int count)Parse a StringBuilder and take out the param token.longprocess(java.io.Reader reader, long lastModifiedDate, java.io.PrintWriter writer)Process a file with server-side commands, reading from reader and writing the processed version to writer.
 
- 
- 
- 
Field Detail- 
COMMAND_STARTprotected static final java.lang.String COMMAND_START The start pattern- See Also:
- Constant Field Values
 
 - 
COMMAND_ENDprotected static final java.lang.String COMMAND_END The end pattern- See Also:
- Constant Field Values
 
 - 
ssiExternalResolverprotected final SSIExternalResolver ssiExternalResolver 
 - 
commandsprotected final java.util.HashMap<java.lang.String,SSICommand> commands 
 - 
debugprotected final int debug 
 - 
allowExecprotected final boolean allowExec 
 
- 
 - 
Constructor Detail- 
SSIProcessorpublic SSIProcessor(SSIExternalResolver ssiExternalResolver, int debug, boolean allowExec) 
 
- 
 - 
Method Detail- 
addBuiltinCommandsprotected void addBuiltinCommands() 
 - 
addCommandpublic void addCommand(java.lang.String name, SSICommand command)
 - 
processpublic long process(java.io.Reader reader, long lastModifiedDate, java.io.PrintWriter writer) throws java.io.IOExceptionProcess 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 from
- lastModifiedDate- resource last modification date
- writer- the writer to write the file with the SSIs processed.
- Returns:
- the most current modified date resulting from any SSI commands
- Throws:
- java.io.IOException- when things go horribly awry. Should be unlikely since the SSICommand usually catches 'normal' IOExceptions.
 
 - 
parseParamNamesprotected java.lang.String[] parseParamNames(java.lang.StringBuilder cmd, int start)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
 
 - 
parseParamValuesprotected java.lang.String[] parseParamValues(java.lang.StringBuilder cmd, int start, int count)Parse a StringBuilder and take out the param token. Called fromrequestHandler- Parameters:
- cmd- a value of type 'StringBuilder'
- start- index on which parsing will start
- count- number of values which should be parsed
- Returns:
- an array with the parameter values
 
 - 
charCmpprotected boolean charCmp(java.lang.String buf, int index, java.lang.String command)
 - 
isSpaceprotected boolean isSpace(char c) 
 - 
isQuoteprotected boolean isQuote(char c) 
 
- 
 
-