org.apache.coyote

Class Request


public final class Request
extends java.lang.Object

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: Tomcat defines a number of attributes:

Authors:
James Duncan Davidson [duncan@eng.sun.com]
James Todd [gonzo@eng.sun.com]
Jason Hunter [jch@eng.sun.com]
Harish Prabandham
Alex Cruikshank [alex@epitonic.com]
Hans Bergsten [hans@gefionsoftware.com]
Costin Manolache
Remy Maucherat

Constructor Summary

Request()

Method Summary

void
action(ActionCode actionCode, Object param)
MessageBytes
contentType()
MessageBytes
decodedURI()
int
doRead(ByteChunk chunk)
Read data from the input buffer and put it into a byte chunk.
Object
getAttribute(String name)
HashMap
getAttributes()
MessageBytes
getAuthType()
int
getBytesRead()
String
getCharacterEncoding()
Get the character encoding used for this request.
int
getContentLength()
long
getContentLengthLong()
String
getContentType()
Cookies
getCookies()
String
getHeader(String name)
InputBuffer
getInputBuffer()
String
getLocalHost()
int
getLocalPort()
MimeHeaders
getMimeHeaders()
Object
getNote(int pos)
Parameters
getParameters()
int
getRemotePort()
MessageBytes
getRemoteUser()
RequestInfo
getRequestProcessor()
Response
getResponse()
int
getServerPort()
long
getStartTime()
UDecoder
getURLDecoder()
MessageBytes
instanceId()
Get the instance id (or JVM route).
MessageBytes
localAddr()
MessageBytes
localName()
MessageBytes
method()
MessageBytes
protocol()
MessageBytes
query()
MessageBytes
queryString()
void
recycle()
MessageBytes
remoteAddr()
MessageBytes
remoteHost()
MessageBytes
requestURI()
MessageBytes
scheme()
MessageBytes
serverName()
Return the buffer holding the server name, if any.
void
setAttribute(String name, Object o)
void
setBytesRead(int bytesRead)
void
setCharacterEncoding(String enc)
void
setContentLength(int len)
void
setContentType(String type)
void
setContentType(MessageBytes mb)
void
setInputBuffer(InputBuffer inputBuffer)
void
setLocalHost(String host)
void
setLocalPort(int port)
void
setNote(int pos, Object value)
void
setRemotePort(int port)
void
setResponse(Response response)
void
setServerPort(int serverPort)
void
setStartTime(long startTime)
String
toString()
MessageBytes
unparsedURI()
void
updateCounters()

Constructor Details

Request

public Request()

Method Details

action

public void action(ActionCode actionCode,
                   Object param)


contentType

public MessageBytes contentType()


decodedURI

public MessageBytes decodedURI()


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()


getAuthType

public MessageBytes getAuthType()


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)


getInputBuffer

public InputBuffer getInputBuffer()


getLocalHost

public String getLocalHost()


getLocalPort

public int getLocalPort()


getMimeHeaders

public MimeHeaders getMimeHeaders()


getNote

public final Object getNote(int pos)


getParameters

public Parameters getParameters()


getRemotePort

public int getRemotePort()


getRemoteUser

public MessageBytes getRemoteUser()


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.

Returns:
the instance id


localAddr

public MessageBytes localAddr()


localName

public MessageBytes localName()


method

public MessageBytes method()


protocol

public MessageBytes protocol()


query

public MessageBytes query()


queryString

public MessageBytes queryString()


recycle

public void recycle()


remoteAddr

public MessageBytes remoteAddr()


remoteHost

public MessageBytes remoteHost()


requestURI

public MessageBytes requestURI()


scheme

public MessageBytes scheme()


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)


setContentType

public void setContentType(MessageBytes mb)


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()


unparsedURI

public MessageBytes unparsedURI()


updateCounters

public void updateCounters()


Copyright B) 2000-2003 Apache Software Foundation. All Rights Reserved.