org.apache.catalina.util.ssi
Class SsiMediator

java.lang.Object
  |
  +--org.apache.catalina.util.ssi.SsiMediator
Direct Known Subclasses:
SsiConfig, SsiEcho, SsiExec, SsiFlastmod, SsiFsize, SsiInclude

public class SsiMediator
extends java.lang.Object

Version:
$Revision: 1.7.2.1 $, $Date: 2001/10/22 21:38:22 $
Author:
Bip Thelin, Amy Roh

Field Summary
protected static java.lang.String contextPath
          The contextPath for this request
protected static int debug
          The debug level for this component
protected static boolean isVirtualWebappRelative
          How this request is being treated
protected static javax.servlet.ServletContext origServletContext
          The original ServletContext
protected static java.io.OutputStream out
          The outputStream to use
protected static java.lang.String path
          The path for this request
protected static java.lang.String relpath
          The relative path for this request
protected static javax.servlet.http.HttpServletRequest req
          The HttpServletResponse associated with this request
protected static javax.servlet.http.HttpServletResponse res
          The HttpServletResponse associated with this request.
protected static java.util.Hashtable serverVariables
          The Servervariables associated with this request
protected static javax.servlet.ServletContext servletContext
          The ServletContext associated with this request
protected static java.util.Hashtable ssiCommands
          The Commands associated with SSI.
 
Constructor Summary
SsiMediator()
           
SsiMediator(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, java.io.OutputStream out, javax.servlet.ServletContext servletContext, int debug, java.lang.String path, boolean isVirtualWebappRelative)
          Initialize and set up out enviroment, called from SsiInvokerServlet
 
Method Summary
 void flush(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, java.io.OutputStream out, javax.servlet.ServletContext servletContext, java.lang.String path, boolean isVirtualWebappRelative)
          Initialize and set up out enviroment, called from SsiInvokerServlet
protected  void flushDate()
          Flush the date and make us ready for a new request.
protected  java.lang.String getCGIPath(java.lang.String path)
           
 SsiCommand getCommand(java.lang.String cmd)
          Get the SsiCommand
protected  java.lang.String getCommandPath(java.lang.String path)
           
 byte[] getError()
          Return the current error message
protected  java.lang.String getFilePath(java.lang.String path)
          Return a path relative to the file being parsed, if they try to use "../" or have a trailing "/" we return null since that is not allowed within a SSI file directive.
protected  java.lang.String getServerVariable(java.lang.String serverVar)
          Get a server variable
protected  java.lang.String getVirtualPath(java.lang.String path)
          Return a path relative to either the webapp or the root("/") Example of valid paths: "/test/path/test.file" "..
protected  java.lang.String timefmt(java.util.Date date)
          Parse a Date according to the current settings.
protected  java.lang.String timefmt(java.lang.String date)
          Parse a Date according to the current settings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serverVariables

protected static java.util.Hashtable serverVariables
The Servervariables associated with this request


ssiCommands

protected static java.util.Hashtable ssiCommands
The Commands associated with SSI.


req

protected static javax.servlet.http.HttpServletRequest req
The HttpServletResponse associated with this request


res

protected static javax.servlet.http.HttpServletResponse res
The HttpServletResponse associated with this request.


out

protected static java.io.OutputStream out
The outputStream to use


servletContext

protected static javax.servlet.ServletContext servletContext
The ServletContext associated with this request


origServletContext

protected static javax.servlet.ServletContext origServletContext
The original ServletContext


contextPath

protected static java.lang.String contextPath
The contextPath for this request


relpath

protected static java.lang.String relpath
The relative path for this request


path

protected static java.lang.String path
The path for this request


debug

protected static int debug
The debug level for this component


isVirtualWebappRelative

protected static boolean isVirtualWebappRelative
How this request is being treated

Constructor Detail

SsiMediator

public SsiMediator()

SsiMediator

public SsiMediator(javax.servlet.http.HttpServletRequest req,
                   javax.servlet.http.HttpServletResponse res,
                   java.io.OutputStream out,
                   javax.servlet.ServletContext servletContext,
                   int debug,
                   java.lang.String path,
                   boolean isVirtualWebappRelative)
Initialize and set up out enviroment, called from SsiInvokerServlet

Parameters:
req - The HttpServletRequest to use
res - The HttpServletResponse to use
out - The OutputStream to use
servletContext - The ServletContext to use
path - The current path
isVirtualWebappRelative - How this request is being treated
Method Detail

getCommand

public final SsiCommand getCommand(java.lang.String cmd)
Get the SsiCommand

Parameters:
cmd - The SsiCommand to get
Returns:
SsiCommand

flush

public void flush(javax.servlet.http.HttpServletRequest req,
                  javax.servlet.http.HttpServletResponse res,
                  java.io.OutputStream out,
                  javax.servlet.ServletContext servletContext,
                  java.lang.String path,
                  boolean isVirtualWebappRelative)
Initialize and set up out enviroment, called from SsiInvokerServlet

Parameters:
req - The HttpServletRequest to use
res - The HttpServletResponse to use
out - The OutputStream to use
servletContext - The ServletContext to use
path - The current path
isVirtualWebappRelative - How this request is being treated

getError

public byte[] getError()
Return the current error message

Returns:
The current error message

flushDate

protected void flushDate()
Flush the date and make us ready for a new request.


timefmt

protected java.lang.String timefmt(java.util.Date date)
Parse a Date according to the current settings.

Parameters:
date - The date to parse
Returns:
The parsed date

timefmt

protected java.lang.String timefmt(java.lang.String date)
Parse a Date according to the current settings.

Parameters:
date - The date to parse
Returns:
The parsed date

getServerVariable

protected java.lang.String getServerVariable(java.lang.String serverVar)
Get a server variable

Parameters:
serverVar - The server variable to get
Returns:
The parsed result

getVirtualPath

protected java.lang.String getVirtualPath(java.lang.String path)
Return a path relative to either the webapp or the root("/") Example of valid paths: "/test/path/test.file" "../test/path/test.file"

Parameters:
path - Path to be normalized

getFilePath

protected java.lang.String getFilePath(java.lang.String path)
Return a path relative to the file being parsed, if they try to use "../" or have a trailing "/" we return null since that is not allowed within a SSI file directive. Example of valid path: "test/path/test.file"

Parameters:
path - Path to be normalized

getCGIPath

protected java.lang.String getCGIPath(java.lang.String path)

getCommandPath

protected java.lang.String getCommandPath(java.lang.String path)


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