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.
Author:
Dan Sandberg, David Becker
  • Field Details

  • Constructor Details

    • SSIProcessor

      public SSIProcessor(SSIExternalResolver ssiExternalResolver, int debug, boolean allowExec)
  • Method Details

    • 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 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:
      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 from requestHandler
      Parameters:
      cmd - a value of type 'StringBuilder'
      start - index on which parsing will start
      Returns:
      an array with the parameter names
    • parseParamValues

      protected String[] parseParamValues(StringBuilder cmd, int start, int count)
      Parse a StringBuilder and take out the param token. Called from requestHandler
      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
    • charCmp

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

      protected boolean isSpace(char c)
    • isQuote

      protected boolean isQuote(char c)