This is a low-level, efficient representation of a server request. Most
fields are GC-free, expensive operations are delayed until the user code
needs the information.
Processing is delegated to modules, using a hook mechanism.
This class is not intended for user code - it is used internally by tomcat
for processing the request in the most efficient way. Users ( servlets ) can
access the information using a facade, which provides the high-level view
of the request.
For lazy evaluation, the request uses the getInfo() hook. The following ids
are defined:
- req.encoding - returns the request encoding
- req.attribute - returns a module-specific attribute ( like SSL keys, etc ).
Tomcat defines a number of attributes:
- "org.apache.tomcat.request" - allows access to the low-level
request object in trusted applications
action
public void action(ActionCode actionCode,
Object param)
doRead
public int doRead(ByteChunk chunk)
throws IOException
Read data from the input buffer and put it into a byte chunk.
getAttribute
public Object getAttribute(String name)
getAttributes
public HashMap getAttributes()
getBytesRead
public int getBytesRead()
getCharacterEncoding
public String getCharacterEncoding()
Get the character encoding used for this request.
getContentLength
public int getContentLength()
getContentLengthLong
public long getContentLengthLong()
getContentType
public String getContentType()
getCookies
public Cookies getCookies()
getHeader
public String getHeader(String name)
getLocalHost
public String getLocalHost()
getLocalPort
public int getLocalPort()
getNote
public final Object getNote(int pos)
getRemotePort
public int getRemotePort()
getRequestProcessor
public RequestInfo getRequestProcessor()
getResponse
public Response getResponse()
getServerPort
public int getServerPort()
getStartTime
public long getStartTime()
getURLDecoder
public UDecoder getURLDecoder()
instanceId
public MessageBytes instanceId()
Get the instance id (or JVM route). Curently Ajp is sending it with each
request. In future this should be fixed, and sent only once ( or
'negociated' at config time so both tomcat and apache share the same name.
- the instance id
recycle
public void recycle()
serverName
public MessageBytes serverName()
Return the buffer holding the server name, if
any. Use isNull() to check if there is no value
set.
This is the "virtual host", derived from the
Host: header.
setAttribute
public void setAttribute(String name,
Object o)
setBytesRead
public void setBytesRead(int bytesRead)
setCharacterEncoding
public void setCharacterEncoding(String enc)
setContentLength
public void setContentLength(int len)
setContentType
public void setContentType(String type)
setInputBuffer
public void setInputBuffer(InputBuffer inputBuffer)
setLocalHost
public void setLocalHost(String host)
setLocalPort
public void setLocalPort(int port)
setNote
public final void setNote(int pos,
Object value)
setRemotePort
public void setRemotePort(int port)
setResponse
public void setResponse(Response response)
setServerPort
public void setServerPort(int serverPort)
setStartTime
public void setStartTime(long startTime)
toString
public String toString()
updateCounters
public void updateCounters()