org.apache.coyote
Class Request

java.lang.Object
  extended byorg.apache.coyote.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:

Author:
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, java.lang.Object param)
           
 MessageBytes contentType()
           
 MessageBytes decodedURI()
           
 int doRead(ByteChunk chunk)
          Read data from the input buffer and put it into a byte chunk.
 java.lang.Object getAttribute(java.lang.String name)
           
 java.util.HashMap getAttributes()
           
 MessageBytes getAuthType()
           
 int getBytesRead()
           
 java.lang.String getCharacterEncoding()
          Get the character encoding used for this request.
 int getContentLength()
           
 long getContentLengthLong()
           
 java.lang.String getContentType()
           
 Cookies getCookies()
           
 java.lang.String getHeader(java.lang.String name)
           
 InputBuffer getInputBuffer()
           
 java.lang.String getLocalHost()
           
 int getLocalPort()
           
 MimeHeaders getMimeHeaders()
           
 java.lang.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(java.lang.String name, java.lang.Object o)
           
 void setBytesRead(int bytesRead)
           
 void setCharacterEncoding(java.lang.String enc)
           
 void setContentLength(int len)
           
 void setContentType(MessageBytes mb)
           
 void setContentType(java.lang.String type)
           
 void setInputBuffer(InputBuffer inputBuffer)
           
 void setLocalHost(java.lang.String host)
           
 void setLocalPort(int port)
           
 void setNote(int pos, java.lang.Object value)
           
 void setRemotePort(int port)
           
 void setResponse(Response response)
           
 void setServerPort(int serverPort)
           
 void setStartTime(long startTime)
           
 java.lang.String toString()
           
 MessageBytes unparsedURI()
           
 void updateCounters()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Request

public Request()
Method Detail

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

getMimeHeaders

public MimeHeaders getMimeHeaders()

getURLDecoder

public UDecoder getURLDecoder()

scheme

public MessageBytes scheme()

method

public MessageBytes method()

unparsedURI

public MessageBytes unparsedURI()

requestURI

public MessageBytes requestURI()

decodedURI

public MessageBytes decodedURI()

query

public MessageBytes query()

queryString

public MessageBytes queryString()

protocol

public MessageBytes protocol()

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.


getServerPort

public int getServerPort()

setServerPort

public void setServerPort(int serverPort)

remoteAddr

public MessageBytes remoteAddr()

remoteHost

public MessageBytes remoteHost()

localName

public MessageBytes localName()

localAddr

public MessageBytes localAddr()

getLocalHost

public java.lang.String getLocalHost()

setLocalHost

public void setLocalHost(java.lang.String host)

getRemotePort

public int getRemotePort()

setRemotePort

public void setRemotePort(int port)

getLocalPort

public int getLocalPort()

setLocalPort

public void setLocalPort(int port)

getCharacterEncoding

public java.lang.String getCharacterEncoding()
Get the character encoding used for this request.


setCharacterEncoding

public void setCharacterEncoding(java.lang.String enc)

setContentLength

public void setContentLength(int len)

getContentLength

public int getContentLength()

getContentLengthLong

public long getContentLengthLong()

getContentType

public java.lang.String getContentType()

setContentType

public void setContentType(java.lang.String type)

contentType

public MessageBytes contentType()

setContentType

public void setContentType(MessageBytes mb)

getHeader

public java.lang.String getHeader(java.lang.String name)

getResponse

public Response getResponse()

setResponse

public void setResponse(Response response)

action

public void action(ActionCode actionCode,
                   java.lang.Object param)

getCookies

public Cookies getCookies()

getParameters

public Parameters getParameters()

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object o)

getAttributes

public java.util.HashMap getAttributes()

getAttribute

public java.lang.Object getAttribute(java.lang.String name)

getRemoteUser

public MessageBytes getRemoteUser()

getAuthType

public MessageBytes getAuthType()

getInputBuffer

public InputBuffer getInputBuffer()

setInputBuffer

public void setInputBuffer(InputBuffer inputBuffer)

doRead

public int doRead(ByteChunk chunk)
           throws java.io.IOException
Read data from the input buffer and put it into a byte chunk.

Throws:
java.io.IOException

toString

public java.lang.String toString()

getStartTime

public long getStartTime()

setStartTime

public void setStartTime(long startTime)

setNote

public final void setNote(int pos,
                          java.lang.Object value)

getNote

public final java.lang.Object getNote(int pos)

recycle

public void recycle()

updateCounters

public void updateCounters()

getRequestProcessor

public RequestInfo getRequestProcessor()

getBytesRead

public int getBytesRead()

setBytesRead

public void setBytesRead(int bytesRead)


Copyright © 2000-2003 Apache Software Foundation. All Rights Reserved.