Package org.apache.catalina.ssi
Class SSIProcessor
- java.lang.Object
-
- org.apache.catalina.ssi.SSIProcessor
-
public class SSIProcessor extends Object
The entry point to SSI processing. This class does the actual parsing, delegating to the SSIMediator, SSICommand, and SSIExternalResolver as necessary[- Version:
- $Revision: 1.4 $, $Date: 2007/05/05 05:32:20 $
- Author:
- Dan Sandberg, David Becker
-
-
Field Summary
Fields Modifier and Type Field Description protected static int
BUFFER_SIZE
protected static String
COMMAND_END
The end patternprotected static String
COMMAND_START
The start patternprotected HashMap<String,SSICommand>
commands
protected int
debug
protected SSIExternalResolver
ssiExternalResolver
-
Constructor Summary
Constructors Constructor Description SSIProcessor(SSIExternalResolver ssiExternalResolver, int debug)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addBuiltinCommands()
void
addCommand(String name, SSICommand command)
protected boolean
charCmp(String buf, int index, String command)
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 Detail
-
COMMAND_START
protected static final String COMMAND_START
The start pattern- See Also:
- Constant Field Values
-
COMMAND_END
protected static final String COMMAND_END
The end pattern- See Also:
- Constant Field Values
-
BUFFER_SIZE
protected static final int BUFFER_SIZE
- See Also:
- Constant Field Values
-
ssiExternalResolver
protected SSIExternalResolver ssiExternalResolver
-
commands
protected HashMap<String,SSICommand> commands
-
debug
protected int debug
-
-
Constructor Detail
-
SSIProcessor
public SSIProcessor(SSIExternalResolver ssiExternalResolver, int debug)
-
-
Method Detail
-
addBuiltinCommands
protected void addBuiltinCommands()
-
addCommand
public void addCommand(String name, SSICommand command)
-
process
public long process(Reader reader, long lastModifiedDate, PrintWriter writer) throws IOException
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 fromwriter
- 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
protected String[] parseParamNames(StringBuilder cmd, int start)
Parse a StringBuilder and take out the param type token. Called fromrequestHandler
- Parameters:
cmd
- a value of type 'StringBuilder'- Returns:
- a value of type 'String[]'
-
parseParamValues
protected String[] parseParamValues(StringBuilder cmd, int start, int count)
Parse a StringBuilder and take out the param token. Called fromrequestHandler
- Parameters:
cmd
- a value of type 'StringBuilder'- Returns:
- a value of type 'String[]'
-
isSpace
protected boolean isSpace(char c)
-
isQuote
protected boolean isQuote(char c)
-
-