|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.tomcat.core.Request
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. Most 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:
Field Summary | |
static java.lang.String |
ATTRIB_REAL_REQUEST
Magic attribute that allows access to the real request from facade - for trusted applications |
protected java.util.Hashtable |
attributes
|
protected java.lang.String |
authType
|
protected int |
available
|
protected java.lang.String |
charEncoding
|
protected Request |
child
|
protected Container |
container
|
protected int |
contentLength
|
protected MessageBytes |
contentTypeMB
|
protected Context |
context
|
protected ContextManager |
contextM
|
protected MessageBytes |
contextMB
|
protected java.text.DateFormat[] |
dateFormats
|
static java.lang.String |
DEFAULT_CHARACTER_ENCODING
|
protected boolean |
didReadFormData
|
protected java.lang.Exception |
errorException
|
protected Handler |
handler
|
protected MimeHeaders |
headers
|
protected java.lang.String |
jvmRoute
|
protected java.lang.String |
localHost
|
static int |
MAX_INCLUDE
|
protected MessageBytes |
methodMB
|
protected boolean |
notAuthenticated
|
protected Parameters |
params
|
protected Request |
parent
|
protected MessageBytes |
pathInfoMB
|
protected java.security.Principal |
principal
|
protected MessageBytes |
protoMB
|
protected MessageBytes |
queryMB
|
protected MessageBytes |
remoteAddrMB
|
protected MessageBytes |
remoteHostMB
|
protected java.lang.String |
remoteUser
|
protected java.lang.String[] |
reqRoles
|
protected java.lang.String |
reqSessionId
|
protected java.lang.Object |
requestFacade
|
protected Response |
response
|
protected MessageBytes |
schemeMB
|
protected Cookies |
scookies
|
protected Container |
security
|
protected MessageBytes |
serverNameMB
|
protected int |
serverPort
|
protected ServerSession |
serverSession
|
protected MessageBytes |
servletPathMB
|
protected java.lang.String |
sessionId
|
static java.lang.String |
SESSIONID_FROM_COOKIE
|
static java.lang.String |
SESSIONID_FROM_URL
|
protected java.lang.String |
sessionIdSource
|
protected int |
state
|
static int |
STATE_CONTEXT_MAPPED
|
static int |
STATE_INVALID
|
static int |
STATE_MAPPED
|
static int |
STATE_NEW
|
static int |
STATE_UNUSED
|
protected Request |
top
|
protected MessageBytes |
unparsedURIMB
|
protected MessageBytes |
uriMB
|
protected UDecoder |
urlDecoder
|
protected java.lang.String[] |
userRoles
|
Constructor Summary | |
Request()
|
Method Summary | |
MessageBytes |
contentType()
|
int |
doRead()
|
int |
doRead(byte[] b,
int off,
int len)
Fill in the buffer. |
java.lang.Object |
getAttribute(java.lang.String name)
|
java.util.Enumeration |
getAttributeNames()
|
java.lang.String |
getAuthType()
|
int |
getAvailable()
How many bytes from the body are still available |
java.lang.String |
getCharacterEncoding()
|
java.lang.String |
getCharEncoding()
|
Request |
getChild()
During include, a sub-request will be created. |
Container |
getContainer()
Return the container ( URL pattern ) where this request has been mapped. |
int |
getContentLength()
|
java.lang.String |
getContentType()
Deprecated. |
Context |
getContext()
|
ContextManager |
getContextManager()
|
Cookies |
getCookies()
|
long |
getDateHeader(java.lang.String name)
Utility method to parse dates. |
java.lang.Object |
getFacade()
|
Handler |
getHandler()
As result of mapping the request a "handler" will be associated and called to generate the result. |
java.lang.String |
getHeader(java.lang.String name)
Deprecated. |
java.util.Enumeration |
getHeaderNames()
Deprecated. |
java.util.Enumeration |
getHeaders(java.lang.String name)
Deprecated. |
java.lang.String |
getJvmRoute()
|
java.lang.String |
getLocalHost()
|
java.lang.String |
getMethod()
Deprecated. After Tomcat 3.2, use method() instead |
MimeHeaders |
getMimeHeaders()
|
java.lang.Object |
getNote(int pos)
|
java.lang.Object |
getNote(java.lang.String name)
|
Request |
getParent()
If this is a sub-request, return the parent ( the request embeding this request ) |
java.lang.String |
getRemoteUser()
|
java.lang.String |
getRequestedSessionId()
Session ID requested by client as a cookie or any other method. |
java.lang.String |
getRequestURI()
Deprecated. After Tomcat 3.2, use requestURI() instead |
java.lang.String[] |
getRequiredRoles()
Deprecated. use getSecurityContext |
Response |
getResponse()
|
Container |
getSecurityContext()
Return the associated security properties for the request. |
int |
getServerPort()
|
ServerSession |
getSession(boolean create)
|
java.lang.String |
getSessionId()
|
java.lang.String |
getSessionIdSource()
Method used to determine requestedSessionId |
int |
getState()
|
Request |
getTop()
This is the top request ( for a sub-request ) |
UDecoder |
getURLDecoder()
|
java.security.Principal |
getUserPrincipal()
Return the principal - the adapter will set it |
java.lang.String[] |
getUserRoles()
|
void |
handlePostParameters()
Read the body, if POST, and add the post parameters. |
void |
handleQueryParameters()
|
void |
initRequest()
|
boolean |
isSecure()
|
boolean |
isUserInRole(java.lang.String role)
|
MessageBytes |
method()
|
Parameters |
parameters()
|
MessageBytes |
pathInfo()
|
MessageBytes |
protocol()
|
MessageBytes |
query()
|
MessageBytes |
queryString()
|
int |
readBody(byte[] body,
int len)
Read request data, filling a byte[] |
void |
recycle()
|
MessageBytes |
remoteAddr()
|
MessageBytes |
remoteHost()
|
void |
removeAttribute(java.lang.String name)
|
MessageBytes |
requestURI()
|
MessageBytes |
scheme()
|
MessageBytes |
serverName()
Return the buffer holding the server name, if any. |
MessageBytes |
servletPath()
|
void |
setAttribute(java.lang.String name,
java.lang.Object value)
|
void |
setAuthType(java.lang.String authType)
|
void |
setAvailable(int len)
|
void |
setCharEncoding(java.lang.String enc)
|
void |
setChild(Request req)
|
void |
setContainer(Container container)
|
void |
setContentLength(int len)
|
void |
setContentType(MessageBytes mb)
Deprecated. |
void |
setContentType(java.lang.String type)
Deprecated. |
void |
setContext(Context context)
Called by mapper interceptors after the context is found or directly by server adapters when this is known in advance |
void |
setContextManager(ContextManager cm)
|
void |
setFacade(java.lang.Object facade)
|
void |
setHandler(Handler handler)
|
void |
setJvmRoute(java.lang.String jvmRoute)
|
void |
setLocalHost(java.lang.String host)
|
void |
setMethod(java.lang.String method)
Deprecated. After Tomcat 3.2, use method() instead |
void |
setNote(int pos,
java.lang.Object value)
|
void |
setNote(java.lang.String name,
java.lang.Object value)
|
void |
setParent(Request req)
|
void |
setRemoteUser(java.lang.String s)
|
void |
setRequestedSessionId(java.lang.String reqSessionId)
|
void |
setRequestURI(java.lang.String r)
Deprecated. After Tomcat 3.2, use requestURI() instead |
void |
setRequiredRoles(java.lang.String[] roles)
|
void |
setResponse(Response response)
|
void |
setSecurityContext(Container ct)
|
void |
setServerPort(int serverPort)
|
void |
setSession(ServerSession serverSession)
Set the session associated with this request. |
void |
setSessionId(java.lang.String id)
"Real" session Id, coresponding to an existing ServerSession |
void |
setSessionIdSource(java.lang.String s)
|
void |
setState(int state)
|
void |
setUserPrincipal(java.security.Principal p)
|
void |
setUserRoles(java.lang.String[] roles)
Deprecated. use setSecurityContext |
java.lang.String |
toString()
|
MessageBytes |
unparsedURI()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final java.lang.String DEFAULT_CHARACTER_ENCODING
public static final java.lang.String SESSIONID_FROM_COOKIE
public static final java.lang.String SESSIONID_FROM_URL
public static final int MAX_INCLUDE
public static final java.lang.String ATTRIB_REAL_REQUEST
public static final int STATE_UNUSED
public static final int STATE_INVALID
public static final int STATE_NEW
public static final int STATE_CONTEXT_MAPPED
public static final int STATE_MAPPED
protected int serverPort
protected java.lang.String localHost
protected int state
protected MessageBytes schemeMB
protected MessageBytes unparsedURIMB
protected MessageBytes methodMB
protected MessageBytes uriMB
protected MessageBytes queryMB
protected MessageBytes protoMB
protected MessageBytes contextMB
protected MessageBytes servletPathMB
protected MessageBytes pathInfoMB
protected MessageBytes remoteAddrMB
protected MessageBytes remoteHostMB
protected java.lang.String jvmRoute
protected java.util.Hashtable attributes
protected MimeHeaders headers
protected Parameters params
protected boolean didReadFormData
protected int contentLength
protected int available
protected MessageBytes contentTypeMB
protected java.lang.String charEncoding
protected MessageBytes serverNameMB
protected java.lang.String authType
protected boolean notAuthenticated
protected java.lang.String remoteUser
protected java.security.Principal principal
protected java.lang.String[] userRoles
protected Container security
protected java.lang.String[] reqRoles
protected Response response
protected ContextManager contextM
protected Context context
protected java.lang.Object requestFacade
protected java.lang.String reqSessionId
protected java.lang.String sessionIdSource
protected java.lang.String sessionId
protected ServerSession serverSession
protected Handler handler
protected Container container
protected Cookies scookies
protected Request top
protected Request parent
protected Request child
protected java.text.DateFormat[] dateFormats
protected UDecoder urlDecoder
protected java.lang.Exception errorException
Constructor Detail |
public Request()
Method Detail |
public final int getState()
public final void setState(int state)
public void setContext(Context context)
public Context getContext()
public UDecoder getURLDecoder()
public void setContextManager(ContextManager cm)
public ContextManager getContextManager()
public java.lang.Object getFacade()
public void setFacade(java.lang.Object facade)
public void setResponse(Response response)
public Response getResponse()
public MimeHeaders getMimeHeaders()
public MessageBytes scheme()
public MessageBytes method()
public java.lang.String getMethod()
method()
instead
public void setMethod(java.lang.String method)
method()
instead
public MessageBytes requestURI()
public java.lang.String getRequestURI()
requestURI()
instead
public void setRequestURI(java.lang.String r)
requestURI()
instead
public MessageBytes unparsedURI()
public MessageBytes query()
public MessageBytes queryString()
public MessageBytes servletPath()
public MessageBytes pathInfo()
public MessageBytes protocol()
public MessageBytes serverName()
public int getServerPort()
public void setServerPort(int serverPort)
public MessageBytes remoteAddr()
public MessageBytes remoteHost()
public java.lang.String getLocalHost()
public void setLocalHost(java.lang.String host)
public void handlePostParameters()
public void handleQueryParameters()
public Parameters parameters()
public java.lang.String getCharacterEncoding()
public java.lang.String getCharEncoding()
public void setCharEncoding(java.lang.String enc)
public void setContentLength(int len)
public int getContentLength()
public java.lang.String getContentType()
public void setContentType(java.lang.String type)
public MessageBytes contentType()
public void setContentType(MessageBytes mb)
public void setAuthType(java.lang.String authType)
public java.lang.String getAuthType()
public void setRemoteUser(java.lang.String s)
public java.lang.String getRemoteUser()
public boolean isSecure()
public void setUserPrincipal(java.security.Principal p)
public java.security.Principal getUserPrincipal()
public void setRequiredRoles(java.lang.String[] roles)
public Container getSecurityContext()
public void setSecurityContext(Container ct)
public java.lang.String[] getRequiredRoles()
public void setUserRoles(java.lang.String[] roles)
public java.lang.String[] getUserRoles()
public boolean isUserInRole(java.lang.String role)
public java.lang.String getJvmRoute()
public void setJvmRoute(java.lang.String jvmRoute)
public java.lang.String getRequestedSessionId()
public void setRequestedSessionId(java.lang.String reqSessionId)
public java.lang.String getSessionIdSource()
public void setSessionIdSource(java.lang.String s)
public void setSessionId(java.lang.String id)
public java.lang.String getSessionId()
public void setSession(ServerSession serverSession)
public ServerSession getSession(boolean create)
public Cookies getCookies()
public Handler getHandler()
public void setHandler(Handler handler)
public Container getContainer()
public void setContainer(Container container)
public final java.lang.Object getAttribute(java.lang.String name)
public final void setAttribute(java.lang.String name, java.lang.Object value)
public void removeAttribute(java.lang.String name)
public java.util.Enumeration getAttributeNames()
public Request getParent()
public void setParent(Request req)
public Request getChild()
public void setChild(Request req)
public Request getTop()
public long getDateHeader(java.lang.String name)
public java.util.Enumeration getHeaders(java.lang.String name)
public java.lang.String getHeader(java.lang.String name)
public java.util.Enumeration getHeaderNames()
public void setAvailable(int len)
public int getAvailable()
public int doRead(byte[] b, int off, int len) throws java.io.IOException
java.io.IOException
public int doRead() throws java.io.IOException
java.io.IOException
public int readBody(byte[] body, int len) throws java.io.IOException
java.io.IOException
public java.lang.String toString()
public final void setNote(int pos, java.lang.Object value)
public final java.lang.Object getNote(int pos)
public java.lang.Object getNote(java.lang.String name) throws TomcatException
TomcatException
public void setNote(java.lang.String name, java.lang.Object value) throws TomcatException
TomcatException
public void recycle()
public void initRequest()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |