| java.lang.Object org.apache.coyote.Request
Request | final public class Request (Code) | | 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
author: James Duncan Davidson [duncan@eng.sun.com] author: James Todd [gonzo@eng.sun.com] author: Jason Hunter [jch@eng.sun.com] author: Harish Prabandham author: Alex Cruikshank [alex@epitonic.com] author: Hans Bergsten [hans@gefionsoftware.com] author: Costin Manolache author: Remy Maucherat |
Constructor Summary | |
public | Request() |
doRead | public int doRead(ByteChunk chunk) throws IOException(Code) | | Read data from the input buffer and put it into a byte chunk.
The buffer is owned by the protocol implementation - it will be reused on the next read.
The Adapter must either process the data in place or copy it to a separate buffer if it needs
to hold it. In most cases this is done during byte->char conversions or via InputStream. Unlike
InputStream, this interface allows the app to process data in place, without copy.
|
getAvailable | public int getAvailable()(Code) | | |
getBytesRead | public int getBytesRead()(Code) | | |
getCharacterEncoding | public String getCharacterEncoding()(Code) | | Get the character encoding used for this request.
|
getContentLength | public int getContentLength()(Code) | | |
getContentLengthLong | public long getContentLengthLong()(Code) | | |
getLocalPort | public int getLocalPort()(Code) | | |
getRemotePort | public int getRemotePort()(Code) | | |
getServerPort | public int getServerPort()(Code) | | |
getStartTime | public long getStartTime()(Code) | | |
instanceId | public MessageBytes instanceId()(Code) | | 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()(Code) | | |
serverName | public MessageBytes serverName()(Code) | | 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.
|
setAvailable | public void setAvailable(int available)(Code) | | |
setBytesRead | public void setBytesRead(int bytesRead)(Code) | | |
setCharacterEncoding | public void setCharacterEncoding(String enc)(Code) | | |
setContentLength | public void setContentLength(int len)(Code) | | |
setLocalPort | public void setLocalPort(int port)(Code) | | |
setNote | final public void setNote(int pos, Object value)(Code) | | Used to store private data. Thread data could be used instead - but
if you have the req, getting/setting a note is just a array access, may
be faster than ThreadLocal for very frequent operations.
Example use:
Jk:
HandlerRequest.HOSTBUFFER = 10 CharChunk, buffer for Host decoding
WorkerEnv: SSL_CERT_NOTE=16 - MessageBytes containing the cert
Catalina CoyoteAdapter:
ADAPTER_NOTES = 1 - stores the HttpServletRequest object ( req/res)
To avoid conflicts, note in the range 0 - 8 are reserved for the
servlet container ( catalina connector, etc ), and values in 9 - 16
for connector use.
17-31 range is not allocated or used.
|
setRemotePort | public void setRemotePort(int port)(Code) | | |
setServerPort | public void setServerPort(int serverPort)(Code) | | |
setStartTime | public void setStartTime(long startTime)(Code) | | |
updateCounters | public void updateCounters()(Code) | | |
|
|