|
|||||||||
| Home >> All >> org >> apache >> [ ajp overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.ajp
Class Ajp13

java.lang.Objectorg.apache.ajp.Ajp13
- public class Ajp13
- extends java.lang.Object
Represents a single, persistent connection between the web server and the servlet container. Uses the Apache JServ Protocol version 1.3 for communication. Because this protocal does not multiplex requests, this connection can only be associated with a single request-handling cycle at a time.
This class contains knowledge about how an individual packet is laid out
(via the Ajp13Packet class), and also about the
stages of communicaton between the server and the servlet container. It
translates from Tomcat's internal servlet support methods
(e.g. doWrite) to the correct packets to send to the web server.
| Field Summary | |
(package private) boolean |
backwardCompat
|
(package private) int |
blen
|
(package private) byte[] |
bodyBuff
|
(package private) int |
currentId
|
protected int |
debug
|
(package private) boolean |
end_of_stream
|
static int |
H_SIZE
|
(package private) java.lang.String[] |
handlerName
|
(package private) AjpHandler[] |
handlers
|
(package private) Ajp13Packet |
hBuf
|
(package private) java.io.InputStream |
in
|
(package private) Ajp13Packet |
inBuf
|
static int |
JK_AJP13_BAD_BODY
|
static int |
JK_AJP13_BAD_HEADER
|
static int |
JK_AJP13_COMM_BROKEN
|
static int |
JK_AJP13_COMM_CLOSED
|
static int |
JK_AJP13_INCOMPLETE_BODY
|
static int |
JK_AJP13_NO_HEADER
|
(package private) boolean |
logged
|
(package private) Logger |
logger
XXX place holder... |
(package private) static int |
MAX_HANDLERS
|
static int |
MAX_PACKET_SIZE
|
static int |
MAX_READ_SIZE
|
static int |
MAX_SEND_SIZE
|
(package private) java.io.OutputStream |
out
|
Ajp13Packet |
outBuf
|
(package private) int |
pos
|
RequestHandler |
reqHandler
|
(package private) static int |
RESERVED
|
(package private) java.lang.String |
secret
|
| Constructor Summary | |
Ajp13()
|
|
Ajp13(RequestHandler reqHandler)
|
|
| Method Summary | |
int |
available()
Deprecated. -- Will use reqHandler, make sure nobody else calls this |
void |
beginSendHeaders(int status,
java.lang.String statusMessage,
int numHeaders)
|
void |
close()
Close the socket connection to the web server. |
int |
doRead()
|
int |
doRead(byte[] b,
int off,
int len)
|
void |
doWrite(byte[] b,
int off,
int len)
|
void |
endSendHeaders()
|
void |
finish()
|
java.lang.String |
getSecret()
|
int |
handleMessage(int type,
Ajp13Packet hBuf,
org.apache.tomcat.util.http.BaseRequest req)
Override for ajp14, temporary |
void |
initBuf()
Will be overriden |
boolean |
isLogged()
|
private int |
readN(java.io.InputStream in,
byte[] b,
int offset,
int len)
Read N bytes from the InputStream, and ensure we got them all Under heavy load we could experience many fragmented packets just read Unix Network Programming to recall that a call to read didn't ensure you got all the data you want from read() Linux manual On success, the number of bytes read is returned (zero indicates end of file), and the file position is advanced by this number. |
int |
receive(Ajp13Packet msg)
Read in a packet from the web server and store it in the passed-in Ajp13Packet object. |
int |
receiveNextRequest(org.apache.tomcat.util.http.BaseRequest req)
Read a new packet from the web server and decode it. |
void |
recycle()
|
private boolean |
refillReadBuffer()
|
int |
registerMessageType(int id,
java.lang.String name,
AjpHandler h,
java.lang.String[] sig)
|
void |
send(Ajp13Packet msg)
Send a packet to the web server. |
void |
sendHeader(java.lang.String name,
java.lang.String value)
|
void |
sendHeaders(int status,
org.apache.tomcat.util.http.MimeHeaders headers)
|
void |
sendHeaders(int status,
java.lang.String statusMessage,
org.apache.tomcat.util.http.MimeHeaders headers)
|
void |
setBackward(boolean b)
Backward compat mode, no login needed |
void |
setDebug(int debug)
|
(package private) void |
setLogged(boolean b)
|
void |
setLogger(Logger l)
|
void |
setSecret(java.lang.String s)
|
void |
setSocket(java.net.Socket socket)
Associate an open socket with this instance. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
MAX_PACKET_SIZE
public static final int MAX_PACKET_SIZE
- See Also:
- Constant Field Values
H_SIZE
public static final int H_SIZE
- See Also:
- Constant Field Values
MAX_READ_SIZE
public static final int MAX_READ_SIZE
- See Also:
- Constant Field Values
MAX_SEND_SIZE
public static final int MAX_SEND_SIZE
- See Also:
- Constant Field Values
JK_AJP13_BAD_HEADER
public static final int JK_AJP13_BAD_HEADER
- See Also:
- Constant Field Values
JK_AJP13_NO_HEADER
public static final int JK_AJP13_NO_HEADER
- See Also:
- Constant Field Values
JK_AJP13_COMM_CLOSED
public static final int JK_AJP13_COMM_CLOSED
- See Also:
- Constant Field Values
JK_AJP13_COMM_BROKEN
public static final int JK_AJP13_COMM_BROKEN
- See Also:
- Constant Field Values
JK_AJP13_BAD_BODY
public static final int JK_AJP13_BAD_BODY
- See Also:
- Constant Field Values
JK_AJP13_INCOMPLETE_BODY
public static final int JK_AJP13_INCOMPLETE_BODY
- See Also:
- Constant Field Values
out
java.io.OutputStream out
in
java.io.InputStream in
outBuf
public Ajp13Packet outBuf
inBuf
Ajp13Packet inBuf
hBuf
Ajp13Packet hBuf
bodyBuff
byte[] bodyBuff
blen
int blen
pos
int pos
end_of_stream
boolean end_of_stream
reqHandler
public RequestHandler reqHandler
backwardCompat
boolean backwardCompat
logged
boolean logged
secret
java.lang.String secret
MAX_HANDLERS
static final int MAX_HANDLERS
- See Also:
- Constant Field Values
RESERVED
static final int RESERVED
- See Also:
- Constant Field Values
handlers
AjpHandler[] handlers
handlerName
java.lang.String[] handlerName
currentId
int currentId
debug
protected int debug
logger
Logger logger
- XXX place holder...
| Constructor Detail |
Ajp13
public Ajp13()
Ajp13
public Ajp13(RequestHandler reqHandler)
| Method Detail |
initBuf
public void initBuf()
- Will be overriden
recycle
public void recycle()
setSocket
public void setSocket(java.net.Socket socket) throws java.io.IOException
- Associate an open socket with this instance.
setBackward
public void setBackward(boolean b)
- Backward compat mode, no login needed
isLogged
public boolean isLogged()
setLogged
void setLogged(boolean b)
setSecret
public void setSecret(java.lang.String s)
getSecret
public java.lang.String getSecret()
registerMessageType
public int registerMessageType(int id,
java.lang.String name,
AjpHandler h,
java.lang.String[] sig)
receiveNextRequest
public int receiveNextRequest(org.apache.tomcat.util.http.BaseRequest req) throws java.io.IOException
- Read a new packet from the web server and decode it. If it's a
forwarded request, store its properties in the passed-in AjpRequest
object.
handleMessage
public int handleMessage(int type,
Ajp13Packet hBuf,
org.apache.tomcat.util.http.BaseRequest req)
throws java.io.IOException
- Override for ajp14, temporary
available
public int available()
throws java.io.IOException
- Deprecated. -- Will use reqHandler, make sure nobody else
calls this
doRead
public int doRead()
throws java.io.IOException
doRead
public int doRead(byte[] b,
int off,
int len)
throws java.io.IOException
refillReadBuffer
private boolean refillReadBuffer()
throws java.io.IOException
beginSendHeaders
public void beginSendHeaders(int status,
java.lang.String statusMessage,
int numHeaders)
throws java.io.IOException
sendHeader
public void sendHeader(java.lang.String name, java.lang.String value) throws java.io.IOException
endSendHeaders
public void endSendHeaders()
throws java.io.IOException
sendHeaders
public void sendHeaders(int status,
org.apache.tomcat.util.http.MimeHeaders headers)
throws java.io.IOException
sendHeaders
public void sendHeaders(int status,
java.lang.String statusMessage,
org.apache.tomcat.util.http.MimeHeaders headers)
throws java.io.IOException
finish
public void finish()
throws java.io.IOException
doWrite
public void doWrite(byte[] b,
int off,
int len)
throws java.io.IOException
readN
private int readN(java.io.InputStream in, byte[] b, int offset, int len) throws java.io.IOException
- Read N bytes from the InputStream, and ensure we got them all
Under heavy load we could experience many fragmented packets
just read Unix Network Programming to recall that a call to
read didn't ensure you got all the data you want
from read() Linux manual
On success, the number of bytes read is returned (zero indicates end of file),
and the file position is advanced by this number.
It is not an error if this number is smaller than the number of bytes requested;
this may happen for example because fewer bytes
are actually available right now (maybe because we were close to end-of-file,
or because we are reading from a pipe, or from a
terminal), or because read() was interrupted by a signal.
On error, -1 is returned, and errno is set appropriately. In this
case it is left unspecified whether the file position (if any) changes.
receive
public int receive(Ajp13Packet msg) throws java.io.IOException
- Read in a packet from the web server and store it in the passed-in
Ajp13Packetobject.
send
public void send(Ajp13Packet msg) throws java.io.IOException
- Send a packet to the web server. Works for any type of message.
close
public void close()
throws java.io.IOException
- Close the socket connection to the web server. In general, sockets
are maintained across many requests, so this will not be called
after finish().
setDebug
public void setDebug(int debug)
setLogger
public void setLogger(Logger l)
|
|||||||||
| Home >> All >> org >> apache >> [ ajp overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.apache.ajp.Ajp13