org.apache.catalina.servlets
クラス CGIServlet.CGIEnvironment

java.lang.Object
  |
  +--org.apache.catalina.servlets.CGIServlet.CGIEnvironment
含まれているクラス:
CGIServlet

protected class CGIServlet.CGIEnvironment
extends java.lang.Object

Encapsulates the CGI environment and rules to derive that environment from the servlet container and request information.

導入されたバージョン:
Tomcat 4.0
バージョン:
$Revision: 1.6 $, $Date: 2001/08/20 02:42:11 $
作成者:
Martin Dengler [root@martindengler.com]

コンストラクタの概要
protected CGIServlet.CGIEnvironment(javax.servlet.http.HttpServletRequest req, javax.servlet.ServletContext context)
          Creates a CGIEnvironment and derives the necessary environment, query parameters, working directory, cgi command, etc.
 
メソッドの概要
protected  java.lang.String blanksToString(java.lang.String couldBeBlank, java.lang.String subForBlanks)
          Converts blank strings to another string
protected  java.lang.String[] findCGI(java.lang.String pathInfo, java.lang.String webAppRootDir, java.lang.String contextPath, java.lang.String servletPath, java.lang.String cgiPathPrefix)
          Resolves core information about the cgi script.
protected  java.lang.String getCommand()
          Gets derived command string
protected  java.util.Hashtable getEnvironment()
          Gets derived CGI environment
protected  java.util.Hashtable getParameters()
          Gets derived CGI query parameters
protected  java.io.File getWorkingDirectory()
          Gets derived CGI working directory
protected  boolean isValid()
          Gets validity status
protected  java.lang.String nullsToBlanks(java.lang.String s)
          Converts null strings to blank strings ("")
protected  java.lang.String nullsToString(java.lang.String couldBeNull, java.lang.String subForNulls)
          Converts null strings to another string
protected  boolean setCGIEnvironment(javax.servlet.http.HttpServletRequest req)
          Constructs the CGI environment to be supplied to the invoked CGI script; relies heavliy on Servlet API methods and findCGI
protected  void setupFromContext(javax.servlet.ServletContext context)
          Uses the ServletContext to set some CGI variables
protected  void setupFromRequest(javax.servlet.http.HttpServletRequest req)
          Uses the HttpServletRequest to set most CGI variables
 java.lang.String toString()
          Print important CGI environment information in a easy-to-read HTML table
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

コンストラクタの詳細

CGIServlet.CGIEnvironment

protected CGIServlet.CGIEnvironment(javax.servlet.http.HttpServletRequest req,
                                    javax.servlet.ServletContext context)
Creates a CGIEnvironment and derives the necessary environment, query parameters, working directory, cgi command, etc.
パラメータ:
req - HttpServletRequest for information provided by the Servlet API
context - ServletContext for information provided by the Servlet API
メソッドの詳細

setupFromContext

protected void setupFromContext(javax.servlet.ServletContext context)
Uses the ServletContext to set some CGI variables
パラメータ:
context - ServletContext for information provided by the Servlet API

setupFromRequest

protected void setupFromRequest(javax.servlet.http.HttpServletRequest req)
Uses the HttpServletRequest to set most CGI variables
パラメータ:
req - HttpServletRequest for information provided by the Servlet API

findCGI

protected java.lang.String[] findCGI(java.lang.String pathInfo,
                                     java.lang.String webAppRootDir,
                                     java.lang.String contextPath,
                                     java.lang.String servletPath,
                                     java.lang.String cgiPathPrefix)
Resolves core information about the cgi script.

Example URI:

 /servlet/cgigateway/dir1/realCGIscript/pathinfo1 

CGI search algorithm: search the real path below <my-webapp-root> and find the first non-directory in the getPathTranslated("/"), reading/searching from left-to-right.

The CGI search path will start at webAppRootDir + File.separator + cgiPathPrefix (or webAppRootDir alone if cgiPathPrefix is null).

cgiPathPrefix is defined by setting this servlet's cgiPathPrefix init parameter

パラメータ:
pathInfo - String from HttpServletRequest.getPathInfo()
webAppRootDir - String from context.getRealPath("/")
contextPath - String as from HttpServletRequest.getContextPath()
servletPath - String as from HttpServletRequest.getServletPath()
cgiPathPrefix - subdirectory of webAppRootDir below which the web app's CGIs may be stored; can be null. The CGI search path will start at webAppRootDir + File.separator + cgiPathPrefix (or webAppRootDir alone if cgiPathPrefix is null). cgiPathPrefix is defined by setting the servlet's cgiPathPrefix init parameter.
戻り値:
  • path - full file-system path to valid cgi script, or null if no cgi was found
  • scriptName - CGI variable SCRIPT_NAME; the full URL path to valid cgi script or null if no cgi was found
  • cgiName - servlet pathInfo fragment corresponding to the cgi script itself, or null if not found
  • name - simple name (no directories) of the cgi script, or null if no cgi was found
導入されたバージョン:
Tomcat 4.0

setCGIEnvironment

protected boolean setCGIEnvironment(javax.servlet.http.HttpServletRequest req)
Constructs the CGI environment to be supplied to the invoked CGI script; relies heavliy on Servlet API methods and findCGI
パラメータ:
HttpServletRequest - request associated with the CGI invokation
戻り値:
true if environment was set OK, false if there was a problem and no environment was set

toString

public java.lang.String toString()
Print important CGI environment information in a easy-to-read HTML table
オーバーライド:
クラス java.lang.Object 内の toString
戻り値:
HTML string containing CGI environment info

getCommand

protected java.lang.String getCommand()
Gets derived command string
戻り値:
command string

getWorkingDirectory

protected java.io.File getWorkingDirectory()
Gets derived CGI working directory
戻り値:
working directory

getEnvironment

protected java.util.Hashtable getEnvironment()
Gets derived CGI environment
戻り値:
CGI environment

getParameters

protected java.util.Hashtable getParameters()
Gets derived CGI query parameters
戻り値:
CGI query parameters

isValid

protected boolean isValid()
Gets validity status
戻り値:
true if this environment is valid, false otherwise

nullsToBlanks

protected java.lang.String nullsToBlanks(java.lang.String s)
Converts null strings to blank strings ("")
パラメータ:
string - to be converted if necessary
戻り値:
a non-null string, either the original or the empty string ("") if the original was null

nullsToString

protected java.lang.String nullsToString(java.lang.String couldBeNull,
                                         java.lang.String subForNulls)
Converts null strings to another string
パラメータ:
string - to be converted if necessary
string - to return instead of a null string
戻り値:
a non-null string, either the original or the substitute string if the original was null

blanksToString

protected java.lang.String blanksToString(java.lang.String couldBeBlank,
                                          java.lang.String subForBlanks)
Converts blank strings to another string
パラメータ:
string - to be converted if necessary
string - to return instead of a blank string
戻り値:
a non-null string, either the original or the substitute string if the original was null or empty ("")


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