Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.ajp
Class RequestHandler  view RequestHandler download RequestHandler.java

java.lang.Object
  extended byorg.apache.ajp.AjpHandler
      extended byorg.apache.ajp.RequestHandler

public class RequestHandler
extends AjpHandler

Handle messages related with basic request information. This object can handle the following incoming messages: - "FORWARD_REQUEST" input message ( sent when a request is passed from the web server ) - "PING REQUEST" input message (sent by the web server to determine if tomcat is not frozen, a PONG REPLY will be sent back) - "RECEIVE_BODY_CHUNK" input ( sent by container to pass more body, in response to GET_BODY_CHUNK ) It can handle the following outgoing messages: - SEND_HEADERS. Pass the status code and headers. - SEND_BODY_CHUNK. Send a chunk of body - GET_BODY_CHUNK. Request a chunk of body data - END_RESPONSE. Notify the end of a request processing.


Field Summary
private  int debug
           
static java.lang.String[] headerTransArray
           
static byte JK_AJP13_CPING_REQUEST
           
static byte JK_AJP13_CPONG_REPLY
           
static byte JK_AJP13_END_RESPONSE
           
static byte JK_AJP13_FORWARD_REQUEST
           
static byte JK_AJP13_GET_BODY_CHUNK
           
static byte JK_AJP13_PING_REQUEST
           
static byte JK_AJP13_SEND_BODY_CHUNK
           
static byte JK_AJP13_SEND_HEADERS
           
static byte JK_AJP13_SHUTDOWN
           
private  Logger logger
           
static java.lang.String[] methodTransArray
           
static byte SC_A_ARE_DONE
           
static byte SC_A_AUTH_TYPE
           
static byte SC_A_CONTEXT
           
static byte SC_A_JVM_ROUTE
           
static byte SC_A_QUERY_STRING
           
static byte SC_A_REMOTE_USER
           
static byte SC_A_REQ_ATTRIBUTE
           
static byte SC_A_SECRET
           
static byte SC_A_SERVLET_PATH
           
static byte SC_A_SSL_CERT
           
static byte SC_A_SSL_CIPHER
           
static byte SC_A_SSL_KEY_SIZE
           
static byte SC_A_SSL_SESSION
           
static byte SC_A_STORED_METHOD
           
static int SC_M_JK_STORED
           
static int SC_REQ_ACCEPT
           
static int SC_REQ_ACCEPT_CHARSET
           
static int SC_REQ_ACCEPT_ENCODING
           
static int SC_REQ_ACCEPT_LANGUAGE
           
static int SC_REQ_AUTHORIZATION
           
static int SC_REQ_CONNECTION
           
static int SC_REQ_CONTENT_LENGTH
           
static int SC_REQ_CONTENT_TYPE
           
static int SC_REQ_COOKIE
           
static int SC_REQ_COOKIE2
           
static int SC_REQ_HOST
           
static int SC_REQ_PRAGMA
           
static int SC_REQ_REFERER
           
static int SC_REQ_USER_AGENT
           
static int SC_RESP_CONTENT_LANGUAGE
           
static int SC_RESP_CONTENT_LENGTH
           
static int SC_RESP_CONTENT_TYPE
           
static int SC_RESP_DATE
           
static int SC_RESP_LAST_MODIFIED
           
static int SC_RESP_LOCATION
           
static int SC_RESP_SERVLET_ENGINE
           
static int SC_RESP_SET_COOKIE
           
static int SC_RESP_SET_COOKIE2
           
static int SC_RESP_STATUS
           
static int SC_RESP_WWW_AUTHENTICATE
           
 
Fields inherited from class org.apache.ajp.AjpHandler
channel, UNKNOWN
 
Constructor Summary
RequestHandler()
           
 
Method Summary
 int available(Ajp13 ch)
           
 void beginSendHeaders(Ajp13 ch, Ajp13Packet outBuf, int status, java.lang.String statusMessage, int numHeaders)
           
protected  int decodeRequest(Ajp13 ch, Ajp13Packet msg, org.apache.tomcat.util.http.BaseRequest req)
          Parse a FORWARD_REQUEST packet from the web server and store its properties in the passed-in request object.
 int doRead(Ajp13 ch)
          Return the next byte of request body data (to a servlet).
 int doRead(Ajp13 ch, byte[] b, int off, int len)
          Store a chunk of request data into the passed-in byte buffer.
 void doWrite(Ajp13 ch, Ajp13Packet outBuf, byte[] b, int off, int len)
          Send a chunk of response body data to the web server and on to the browser.
 void endSendHeaders(Ajp13 ch, Ajp13Packet outBuf)
           
 void finish(Ajp13 ch, Ajp13Packet outBuf)
          Signal the web server that the servlet has finished handling this request, and that the connection can be reused.
 int handleAjpMessage(int type, Ajp13 channel, Ajp13Packet ajp, org.apache.tomcat.util.http.BaseRequest req)
          Execute the callback
protected  int headerNameToSc(java.lang.String name)
          Translate an HTTP response header name to an integer code if possible.
 void init(Ajp13 ajp14)
           
(package private)  void log(java.lang.String s)
           
 boolean refillReadBuffer(Ajp13 ch)
          Get more request body data from the web server and store it in the internal buffer.
 int sendCPong(Ajp13 ch, Ajp13Packet outBuf)
          Send a CPONG REPLY to web server to its CPING request
 void sendHeader(Ajp13Packet outBuf, java.lang.String name, java.lang.String value)
           
 void sendHeaders(Ajp13 ch, Ajp13Packet outBuf, int status, org.apache.tomcat.util.http.MimeHeaders headers)
          Send the HTTP headers back to the web server and on to the browser.
 void sendHeaders(Ajp13 ch, Ajp13Packet outBuf, int status, java.lang.String statusMessage, org.apache.tomcat.util.http.MimeHeaders headers)
          Send the HTTP headers back to the web server and on to the browser.
 void setDebug(int debug)
           
 void setLogger(Logger l)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JK_AJP13_FORWARD_REQUEST

public static final byte JK_AJP13_FORWARD_REQUEST
See Also:
Constant Field Values

JK_AJP13_SHUTDOWN

public static final byte JK_AJP13_SHUTDOWN
See Also:
Constant Field Values

JK_AJP13_PING_REQUEST

public static final byte JK_AJP13_PING_REQUEST
See Also:
Constant Field Values

JK_AJP13_CPING_REQUEST

public static final byte JK_AJP13_CPING_REQUEST
See Also:
Constant Field Values

JK_AJP13_SEND_BODY_CHUNK

public static final byte JK_AJP13_SEND_BODY_CHUNK
See Also:
Constant Field Values

JK_AJP13_SEND_HEADERS

public static final byte JK_AJP13_SEND_HEADERS
See Also:
Constant Field Values

JK_AJP13_END_RESPONSE

public static final byte JK_AJP13_END_RESPONSE
See Also:
Constant Field Values

JK_AJP13_GET_BODY_CHUNK

public static final byte JK_AJP13_GET_BODY_CHUNK
See Also:
Constant Field Values

JK_AJP13_CPONG_REPLY

public static final byte JK_AJP13_CPONG_REPLY
See Also:
Constant Field Values

SC_RESP_CONTENT_TYPE

public static final int SC_RESP_CONTENT_TYPE
See Also:
Constant Field Values

SC_RESP_CONTENT_LANGUAGE

public static final int SC_RESP_CONTENT_LANGUAGE
See Also:
Constant Field Values

SC_RESP_CONTENT_LENGTH

public static final int SC_RESP_CONTENT_LENGTH
See Also:
Constant Field Values

SC_RESP_DATE

public static final int SC_RESP_DATE
See Also:
Constant Field Values

SC_RESP_LAST_MODIFIED

public static final int SC_RESP_LAST_MODIFIED
See Also:
Constant Field Values

SC_RESP_LOCATION

public static final int SC_RESP_LOCATION
See Also:
Constant Field Values

SC_RESP_SET_COOKIE

public static final int SC_RESP_SET_COOKIE
See Also:
Constant Field Values

SC_RESP_SET_COOKIE2

public static final int SC_RESP_SET_COOKIE2
See Also:
Constant Field Values

SC_RESP_SERVLET_ENGINE

public static final int SC_RESP_SERVLET_ENGINE
See Also:
Constant Field Values

SC_RESP_STATUS

public static final int SC_RESP_STATUS
See Also:
Constant Field Values

SC_RESP_WWW_AUTHENTICATE

public static final int SC_RESP_WWW_AUTHENTICATE
See Also:
Constant Field Values

SC_A_CONTEXT

public static final byte SC_A_CONTEXT
See Also:
Constant Field Values

SC_A_SERVLET_PATH

public static final byte SC_A_SERVLET_PATH
See Also:
Constant Field Values

SC_A_REMOTE_USER

public static final byte SC_A_REMOTE_USER
See Also:
Constant Field Values

SC_A_AUTH_TYPE

public static final byte SC_A_AUTH_TYPE
See Also:
Constant Field Values

SC_A_QUERY_STRING

public static final byte SC_A_QUERY_STRING
See Also:
Constant Field Values

SC_A_JVM_ROUTE

public static final byte SC_A_JVM_ROUTE
See Also:
Constant Field Values

SC_A_SSL_CERT

public static final byte SC_A_SSL_CERT
See Also:
Constant Field Values

SC_A_SSL_CIPHER

public static final byte SC_A_SSL_CIPHER
See Also:
Constant Field Values

SC_A_SSL_SESSION

public static final byte SC_A_SSL_SESSION
See Also:
Constant Field Values

SC_A_SSL_KEY_SIZE

public static final byte SC_A_SSL_KEY_SIZE
See Also:
Constant Field Values

SC_A_SECRET

public static final byte SC_A_SECRET
See Also:
Constant Field Values

SC_A_STORED_METHOD

public static final byte SC_A_STORED_METHOD
See Also:
Constant Field Values

SC_A_REQ_ATTRIBUTE

public static final byte SC_A_REQ_ATTRIBUTE
See Also:
Constant Field Values

SC_A_ARE_DONE

public static final byte SC_A_ARE_DONE
See Also:
Constant Field Values

methodTransArray

public static final java.lang.String[] methodTransArray

SC_M_JK_STORED

public static final int SC_M_JK_STORED
See Also:
Constant Field Values

SC_REQ_ACCEPT

public static final int SC_REQ_ACCEPT
See Also:
Constant Field Values

SC_REQ_ACCEPT_CHARSET

public static final int SC_REQ_ACCEPT_CHARSET
See Also:
Constant Field Values

SC_REQ_ACCEPT_ENCODING

public static final int SC_REQ_ACCEPT_ENCODING
See Also:
Constant Field Values

SC_REQ_ACCEPT_LANGUAGE

public static final int SC_REQ_ACCEPT_LANGUAGE
See Also:
Constant Field Values

SC_REQ_AUTHORIZATION

public static final int SC_REQ_AUTHORIZATION
See Also:
Constant Field Values

SC_REQ_CONNECTION

public static final int SC_REQ_CONNECTION
See Also:
Constant Field Values

SC_REQ_CONTENT_TYPE

public static final int SC_REQ_CONTENT_TYPE
See Also:
Constant Field Values

SC_REQ_CONTENT_LENGTH

public static final int SC_REQ_CONTENT_LENGTH
See Also:
Constant Field Values

SC_REQ_COOKIE

public static final int SC_REQ_COOKIE
See Also:
Constant Field Values

SC_REQ_COOKIE2

public static final int SC_REQ_COOKIE2
See Also:
Constant Field Values

SC_REQ_HOST

public static final int SC_REQ_HOST
See Also:
Constant Field Values

SC_REQ_PRAGMA

public static final int SC_REQ_PRAGMA
See Also:
Constant Field Values

SC_REQ_REFERER

public static final int SC_REQ_REFERER
See Also:
Constant Field Values

SC_REQ_USER_AGENT

public static final int SC_REQ_USER_AGENT
See Also:
Constant Field Values

headerTransArray

public static final java.lang.String[] headerTransArray

debug

private int debug

logger

private Logger logger
Constructor Detail

RequestHandler

public RequestHandler()
Method Detail

init

public void init(Ajp13 ajp14)
Overrides:
init in class AjpHandler

sendCPong

public int sendCPong(Ajp13 ch,
                     Ajp13Packet outBuf)
Send a CPONG REPLY to web server to its CPING request


handleAjpMessage

public int handleAjpMessage(int type,
                            Ajp13 channel,
                            Ajp13Packet ajp,
                            org.apache.tomcat.util.http.BaseRequest req)
                     throws java.io.IOException
Description copied from class: AjpHandler
Execute the callback

Overrides:
handleAjpMessage in class AjpHandler

decodeRequest

protected int decodeRequest(Ajp13 ch,
                            Ajp13Packet msg,
                            org.apache.tomcat.util.http.BaseRequest req)
                     throws java.io.IOException
Parse a FORWARD_REQUEST packet from the web server and store its properties in the passed-in request object.


sendHeaders

public void sendHeaders(Ajp13 ch,
                        Ajp13Packet outBuf,
                        int status,
                        java.lang.String statusMessage,
                        org.apache.tomcat.util.http.MimeHeaders headers)
                 throws java.io.IOException
Send the HTTP headers back to the web server and on to the browser.


finish

public void finish(Ajp13 ch,
                   Ajp13Packet outBuf)
            throws java.io.IOException
Signal the web server that the servlet has finished handling this request, and that the connection can be reused.


doWrite

public void doWrite(Ajp13 ch,
                    Ajp13Packet outBuf,
                    byte[] b,
                    int off,
                    int len)
             throws java.io.IOException
Send a chunk of response body data to the web server and on to the browser.


headerNameToSc

protected int headerNameToSc(java.lang.String name)
Translate an HTTP response header name to an integer code if possible. Case is ignored.


setDebug

public void setDebug(int debug)

setLogger

public void setLogger(Logger l)

log

void log(java.lang.String s)

available

public int available(Ajp13 ch)
              throws java.io.IOException

doRead

public int doRead(Ajp13 ch)
           throws java.io.IOException
Return the next byte of request body data (to a servlet).


doRead

public int doRead(Ajp13 ch,
                  byte[] b,
                  int off,
                  int len)
           throws java.io.IOException
Store a chunk of request data into the passed-in byte buffer.


refillReadBuffer

public boolean refillReadBuffer(Ajp13 ch)
                         throws java.io.IOException
Get more request body data from the web server and store it in the internal buffer.


beginSendHeaders

public void beginSendHeaders(Ajp13 ch,
                             Ajp13Packet outBuf,
                             int status,
                             java.lang.String statusMessage,
                             int numHeaders)
                      throws java.io.IOException

sendHeader

public void sendHeader(Ajp13Packet outBuf,
                       java.lang.String name,
                       java.lang.String value)
                throws java.io.IOException

endSendHeaders

public void endSendHeaders(Ajp13 ch,
                           Ajp13Packet outBuf)
                    throws java.io.IOException

sendHeaders

public void sendHeaders(Ajp13 ch,
                        Ajp13Packet outBuf,
                        int status,
                        org.apache.tomcat.util.http.MimeHeaders headers)
                 throws java.io.IOException
Send the HTTP headers back to the web server and on to the browser.