org.apache.catalina.ssi

Class 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: 649207 $, $Date: 2008-04-17 19:55:30 +0200 (Thu, 17 Apr 2008) $

Author: Dan Sandberg David Becker

Field Summary
protected static intBUFFER_SIZE
protected HashMapcommands
protected static StringCOMMAND_END
The end pattern
protected static StringCOMMAND_START
The start pattern
protected intdebug
protected SSIExternalResolverssiExternalResolver
Constructor Summary
SSIProcessor(SSIExternalResolver ssiExternalResolver, int debug)
Method Summary
protected voidaddBuiltinCommands()
voidaddCommand(String name, SSICommand command)
protected booleancharCmp(String buf, int index, String command)
protected booleanisQuote(char c)
protected booleanisSpace(char c)
protected String[]parseParamNames(StringBuffer cmd, int start)
Parse a StringBuffer and take out the param type token.
protected String[]parseParamValues(StringBuffer cmd, int start, int count)
Parse a StringBuffer and take out the param token.
longprocess(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

BUFFER_SIZE

protected static final int BUFFER_SIZE

commands

protected HashMap commands

COMMAND_END

protected static final String COMMAND_END
The end pattern

COMMAND_START

protected static final String COMMAND_START
The start pattern

debug

protected int debug

ssiExternalResolver

protected SSIExternalResolver ssiExternalResolver

Constructor Detail

SSIProcessor

public SSIProcessor(SSIExternalResolver ssiExternalResolver, int debug)

Method Detail

addBuiltinCommands

protected void addBuiltinCommands()

addCommand

public void addCommand(String name, SSICommand command)

charCmp

protected boolean charCmp(String buf, int index, String command)

isQuote

protected boolean isQuote(char c)

isSpace

protected boolean isSpace(char c)

parseParamNames

protected String[] parseParamNames(StringBuffer cmd, int start)
Parse a StringBuffer and take out the param type token. Called from requestHandler

Parameters: cmd a value of type 'StringBuffer'

Returns: a value of type 'String[]'

parseParamValues

protected String[] parseParamValues(StringBuffer cmd, int start, int count)
Parse a StringBuffer and take out the param token. Called from requestHandler

Parameters: cmd a value of type 'StringBuffer'

Returns: a value of type 'String[]'

process

public 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. 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 writer 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.

Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.