wt.tools.javarmi
Class CGIHandlerTS

java.lang.Object
  extended bywt.tools.javarmi.CGIHandlerTS
All Implemented Interfaces:
Runnable

public class CGIHandlerTS
extends Object
implements Runnable

A thread-safe version of the sun.rmi.transport.proxy.CGIHandler class

See Also:
sun.rmi.transport.proxy

Field Summary
private  Hashtable commandLookup
           
private  CGICommandHandlerTS[] commands
           
private  int contentLength
           
private  InputStream in
           
private  OutputStream out
           
private  String queryString
           
private  javax.servlet.http.HttpServletRequest request
           
private  String requestMethod
           
private  javax.servlet.http.HttpServletResponse response
           
private  String serverName
           
private  int serverPort
           
 
Constructor Summary
CGIHandlerTS(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Standard constructor, takes a Properties object and input and output streams.
 
Method Summary
 int getContentLength()
          This and the other 'get' methods are accessors for the relevant properties and streams.
 InputStream getInputStream()
           
 OutputStream getOutputStream()
           
 String getQueryString()
           
 javax.servlet.http.HttpServletRequest getRequest()
           
 javax.servlet.http.HttpServletResponse getResponse()
           
 String getServerName()
           
 int getServerPort()
           
private  void returnClientError(String error)
          Writes a client error to the OutputStream
private  void returnServerError(String error)
          Writes a server error to the OutputStream
 void run()
          The body of the thread, it parses the query string and calls one of the four CGICommandHandlerTS implementations appropriately
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

request

private javax.servlet.http.HttpServletRequest request

response

private javax.servlet.http.HttpServletResponse response

in

private InputStream in

out

private OutputStream out

contentLength

private int contentLength

queryString

private String queryString

requestMethod

private String requestMethod

serverName

private String serverName

serverPort

private int serverPort

commands

private CGICommandHandlerTS[] commands

commandLookup

private Hashtable commandLookup
Constructor Detail

CGIHandlerTS

public CGIHandlerTS(javax.servlet.http.HttpServletRequest request,
                    javax.servlet.http.HttpServletResponse response)
Standard constructor, takes a Properties object and input and output streams.

Method Detail

getContentLength

public int getContentLength()
This and the other 'get' methods are accessors for the relevant properties and streams. This instance of CGIHandlerTS is passed to the CGICommandHandlerTS implementations, and these accessors are called from there.

Returns:
The length of the query string ("CONTENT_LENGTH" CGI environment variable)

getQueryString

public String getQueryString()
Returns:
The query string ("QUERY_STRING" CGI environment variable)

getServerName

public String getServerName()
Returns:
The server name ("SERVER_NAME" CGI environment variable)

getServerPort

public int getServerPort()
Returns:
The server port ("SERVER_PORT" CGI environment variable)

getRequest

public javax.servlet.http.HttpServletRequest getRequest()
Returns:
The HttpServletRequest instance

getResponse

public javax.servlet.http.HttpServletResponse getResponse()
Returns:
The HttpServletResponse instance

getInputStream

public InputStream getInputStream()
Returns:
The InputStream to read from (for POST)

getOutputStream

public OutputStream getOutputStream()
Returns:
The OutputStream to write to

run

public void run()
The body of the thread, it parses the query string and calls one of the four CGICommandHandlerTS implementations appropriately

Specified by:
run in interface Runnable

returnClientError

private void returnClientError(String error)
Writes a client error to the OutputStream


returnServerError

private void returnServerError(String error)
Writes a server error to the OutputStream