org.apache.tomcat.core
Class RequestImpl

java.lang.Object
  |
  +--org.apache.tomcat.core.RequestImpl

public class RequestImpl
extends java.lang.Object
implements Request

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]

Field Summary
protected  java.util.Hashtable attributes
           
protected  java.lang.String authType
           
protected  java.lang.String charEncoding
           
protected  int contentLength
           
protected  java.lang.String contentType
           
protected  Context context
           
protected  ContextManager contextM
           
protected  java.lang.String contextPath
           
protected  java.util.Vector cookies
           
protected  boolean didCookies
           
protected  boolean didParameters
           
protected  boolean didReadFormData
           
protected  ServletWrapper handler
           
protected  org.apache.tomcat.util.MimeHeaders headers
           
protected  javax.servlet.ServletInputStream in
           
protected  java.lang.String jvmRoute
           
protected  java.lang.String lookupPath
           
protected  java.lang.String mappedPath
           
protected  java.lang.String method
           
protected  java.util.Hashtable parameters
           
protected  java.lang.String pathInfo
           
protected  java.lang.String pathTranslated
           
protected  boolean pathTranslatedIsSet
           
protected  java.lang.String protocol
           
protected  java.lang.String queryString
           
protected  java.lang.String remoteAddr
           
protected  java.lang.String remoteHost
           
protected  java.lang.String remoteUser
           
protected  java.lang.String reqSessionId
           
protected  HttpServletRequestFacade requestFacade
           
protected  java.lang.String requestURI
           
protected  Response response
           
protected  java.lang.String scheme
           
protected  java.lang.String serverName
           
protected  int serverPort
           
protected  javax.servlet.http.HttpSession serverSession
           
protected  java.lang.String servletName
           
protected  java.lang.String servletPath
           
protected  boolean sessionIdFromCookie
           
protected  boolean sessionIdFromURL
           
protected static org.apache.tomcat.util.StringManager sm
           
 
Constructor Summary
RequestImpl()
           
 
Method Summary
 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()
           
 java.lang.String getCharacterEncoding()
           
 Container getContainer()
           
 int getContentLength()
           
 java.lang.String getContentType()
           
 Context getContext()
           
 ContextManager getContextManager()
           
 javax.servlet.http.Cookie[] getCookies()
          Return the cookies
 HttpServletRequestFacade getFacade()
          One-to-One with Facade
 java.lang.String getHeader(java.lang.String name)
           
 java.util.Enumeration getHeaderNames()
           
 java.util.Enumeration getHeaders(java.lang.String name)
           
 javax.servlet.ServletInputStream getInputStream()
           
 java.lang.String getJvmRoute()
           
 java.lang.String getLookupPath()
           
 java.lang.String getMappedPath()
          The file - result of mapping the request ( using aliases and other mapping rules.
 java.lang.String getMethod()
           
 org.apache.tomcat.util.MimeHeaders getMimeHeaders()
           
 java.util.Enumeration getParameterNames()
           
 java.util.Hashtable getParameters()
           
 java.lang.String[] getParameterValues(java.lang.String name)
           
 java.lang.String getPathInfo()
          Path Info - set be mappers or from adapter
 java.lang.String getPathTranslated()
          Real Path - should be implemented as a callback ( override it in adapters).
 java.lang.String getProtocol()
           
 java.lang.String getQueryString()
           
 java.io.BufferedReader getReader()
           
 java.lang.String getRemoteAddr()
           
 java.lang.String getRemoteHost()
          Expensive - should be implemented as a callback where possible!
 java.lang.String getRemoteUser()
           
 java.lang.String getRequestedSessionId()
           
 java.lang.String getRequestURI()
           
 Response getResponse()
          One-to-One with Response
 java.lang.String getScheme()
           
 java.lang.String getServerName()
           
 int getServerPort()
           
 java.lang.String getServletPath()
           
 java.lang.String getServletPrefix()
           
 javax.servlet.http.HttpSession getSession(boolean create)
           
 java.security.Principal getUserPrincipal()
           
 ServletWrapper getWrapper()
          Wrapper - the servlet that will execute the request Similar with "handler" in Apache.
 boolean isRequestedSessionIdFromCookie()
           
 boolean isRequestedSessionIdFromURL()
           
 boolean isRequestedSessionIdValid()
           
 boolean isSecure()
           
 boolean isUserInRole(java.lang.String role)
           
 void recycle()
          Support for "pools"
 void removeAttribute(java.lang.String name)
           
 void setAttribute(java.lang.String name, java.lang.Object value)
           
 void setAuthType(java.lang.String authType)
           
 void setBody(java.lang.StringBuffer body)
           
 void setCharEncoding(java.lang.String enc)
           
 void setContainer(Container container)
           
 void setContentLength(int len)
           
 void setContentType(java.lang.String type)
           
 void setContext(Context context)
          Context - will be set by contextMap stage of request interceptors
 void setContextManager(ContextManager cm)
          Pointer to the server engine - for errors, etc
 void setLookupPath(java.lang.String l)
          Everything after context path ( servletPath + pathInfo + queryInfo )
 void setMappedPath(java.lang.String m)
           
 void setMethod(java.lang.String method)
           
 void setMimeHeaders(org.apache.tomcat.util.MimeHeaders headers)
           
 void setParameters(java.util.Hashtable h)
           
 void setPathInfo(java.lang.String pathInfo)
           
 void setPathTranslated(java.lang.String s)
          All adapters that know the PT needs to call this method, in order to set pathTranslatedIsSet, otherwise tomcat will try to compute it again
 void setProtocol(java.lang.String protocol)
           
 void setQueryString(java.lang.String queryString)
          Set query string - will be called by forward
 void setRemoteAddr(java.lang.String remoteAddr)
           
 void setRemoteHost(java.lang.String remoteHost)
           
 void setRemoteUser(java.lang.String s)
           
 void setRequestedSessionId(java.lang.String reqSessionId)
           
 void setRequestedSessionIdFromCookie(boolean newState)
           
 void setRequestedSessionIdFromURL(boolean newState)
           
 void setRequestURI(java.lang.String r)
           
 void setResponse(Response response)
           
 void setScheme(java.lang.String scheme)
           
 void setServerName(java.lang.String serverName)
          Virtual host
 void setServerPort(int serverPort)
           
 void setServletPath(java.lang.String servletPath)
          Servlet Path
 void setSession(javax.servlet.http.HttpSession serverSession)
           
 void setWrapper(ServletWrapper handler)
           
 java.lang.String toString()
           
 java.lang.String toStringDebug()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

jvmRoute

protected java.lang.String jvmRoute

requestURI

protected java.lang.String requestURI

queryString

protected java.lang.String queryString

serverName

protected java.lang.String serverName

cookies

protected java.util.Vector cookies

contextPath

protected java.lang.String contextPath

lookupPath

protected java.lang.String lookupPath

servletPath

protected java.lang.String servletPath

pathInfo

protected java.lang.String pathInfo

pathTranslated

protected java.lang.String pathTranslated

pathTranslatedIsSet

protected boolean pathTranslatedIsSet

parameters

protected java.util.Hashtable parameters

contentLength

protected int contentLength

contentType

protected java.lang.String contentType

charEncoding

protected java.lang.String charEncoding

authType

protected java.lang.String authType

remoteUser

protected java.lang.String remoteUser

response

protected Response response

requestFacade

protected HttpServletRequestFacade requestFacade

context

protected Context context

contextM

protected ContextManager contextM

attributes

protected java.util.Hashtable attributes

didReadFormData

protected boolean didReadFormData

didParameters

protected boolean didParameters

didCookies

protected boolean didCookies

reqSessionId

protected java.lang.String reqSessionId

sessionIdFromCookie

protected boolean sessionIdFromCookie

sessionIdFromURL

protected boolean sessionIdFromURL

serverSession

protected javax.servlet.http.HttpSession serverSession

servletName

protected java.lang.String servletName

handler

protected ServletWrapper handler

mappedPath

protected java.lang.String mappedPath

scheme

protected java.lang.String scheme

method

protected java.lang.String method

protocol

protected java.lang.String protocol

headers

protected org.apache.tomcat.util.MimeHeaders headers

in

protected javax.servlet.ServletInputStream in

serverPort

protected int serverPort

remoteAddr

protected java.lang.String remoteAddr

remoteHost

protected java.lang.String remoteHost

sm

protected static org.apache.tomcat.util.StringManager sm
Constructor Detail

RequestImpl

public RequestImpl()
Method Detail

getJvmRoute

public java.lang.String getJvmRoute()
Specified by:
getJvmRoute in interface Request

getScheme

public java.lang.String getScheme()
Specified by:
getScheme in interface Request

getMethod

public java.lang.String getMethod()
Specified by:
getMethod in interface Request

getRequestURI

public java.lang.String getRequestURI()
Specified by:
getRequestURI in interface Request

getQueryString

public java.lang.String getQueryString()
Specified by:
getQueryString in interface Request

getProtocol

public java.lang.String getProtocol()
Specified by:
getProtocol in interface Request

getServerName

public java.lang.String getServerName()
Specified by:
getServerName in interface Request

getLookupPath

public java.lang.String getLookupPath()
Specified by:
getLookupPath in interface Request

setLookupPath

public void setLookupPath(java.lang.String l)
Description copied from interface: Request
Everything after context path ( servletPath + pathInfo + queryInfo )
Specified by:
setLookupPath in interface Request

getParameterValues

public java.lang.String[] getParameterValues(java.lang.String name)
Specified by:
getParameterValues in interface Request

getParameterNames

public java.util.Enumeration getParameterNames()
Specified by:
getParameterNames in interface Request

getAuthType

public java.lang.String getAuthType()
Specified by:
getAuthType in interface Request

getCharacterEncoding

public java.lang.String getCharacterEncoding()
Specified by:
getCharacterEncoding in interface Request

getContentLength

public int getContentLength()
Specified by:
getContentLength in interface Request

getContentType

public java.lang.String getContentType()
Specified by:
getContentType in interface Request

setPathTranslated

public void setPathTranslated(java.lang.String s)
All adapters that know the PT needs to call this method, in order to set pathTranslatedIsSet, otherwise tomcat will try to compute it again
Specified by:
setPathTranslated in interface Request

getPathTranslated

public java.lang.String getPathTranslated()
Description copied from interface: Request
Real Path - should be implemented as a callback ( override it in adapters). Map interceptor should set it to something reasonable ( context home + path ) MappedPath is similar - it contain mappings inside a context, for normal contexts pathTranslated==context.docBase + mappedPath
Specified by:
getPathTranslated in interface Request

getPathInfo

public java.lang.String getPathInfo()
Description copied from interface: Request
Path Info - set be mappers or from adapter
Specified by:
getPathInfo in interface Request

setRemoteUser

public void setRemoteUser(java.lang.String s)
Specified by:
setRemoteUser in interface Request

getRemoteUser

public java.lang.String getRemoteUser()
Specified by:
getRemoteUser in interface Request

isSecure

public boolean isSecure()
Specified by:
isSecure in interface Request

getUserPrincipal

public java.security.Principal getUserPrincipal()
Specified by:
getUserPrincipal in interface Request

isUserInRole

public boolean isUserInRole(java.lang.String role)
Specified by:
isUserInRole in interface Request

getRequestedSessionId

public java.lang.String getRequestedSessionId()
Specified by:
getRequestedSessionId in interface Request

setRequestedSessionId

public void setRequestedSessionId(java.lang.String reqSessionId)
Specified by:
setRequestedSessionId in interface Request

getServletPath

public java.lang.String getServletPath()
Specified by:
getServletPath in interface Request

getFacade

public HttpServletRequestFacade getFacade()
Description copied from interface: Request
One-to-One with Facade
Specified by:
getFacade in interface Request

getContext

public Context getContext()
Specified by:
getContext in interface Request

setResponse

public void setResponse(Response response)
Specified by:
setResponse in interface Request

getResponse

public Response getResponse()
Description copied from interface: Request
One-to-One with Response
Specified by:
getResponse in interface Request

isRequestedSessionIdFromCookie

public boolean isRequestedSessionIdFromCookie()
Specified by:
isRequestedSessionIdFromCookie in interface Request

isRequestedSessionIdFromURL

public boolean isRequestedSessionIdFromURL()
Specified by:
isRequestedSessionIdFromURL in interface Request

setRequestedSessionIdFromCookie

public void setRequestedSessionIdFromCookie(boolean newState)
Specified by:
setRequestedSessionIdFromCookie in interface Request

setRequestedSessionIdFromURL

public void setRequestedSessionIdFromURL(boolean newState)
Specified by:
setRequestedSessionIdFromURL in interface Request

setContext

public void setContext(Context context)
Description copied from interface: Request
Context - will be set by contextMap stage of request interceptors
Specified by:
setContext in interface Request

setContextManager

public void setContextManager(ContextManager cm)
Description copied from interface: Request
Pointer to the server engine - for errors, etc
Specified by:
setContextManager in interface Request

getContextManager

public ContextManager getContextManager()
Specified by:
getContextManager in interface Request

getCookies

public javax.servlet.http.Cookie[] getCookies()
Description copied from interface: Request
Return the cookies
Specified by:
getCookies in interface Request

getSession

public javax.servlet.http.HttpSession getSession(boolean create)
Specified by:
getSession in interface Request

isRequestedSessionIdValid

public boolean isRequestedSessionIdValid()
Specified by:
isRequestedSessionIdValid in interface Request

getWrapper

public ServletWrapper getWrapper()
Description copied from interface: Request
Wrapper - the servlet that will execute the request Similar with "handler" in Apache.
Specified by:
getWrapper in interface Request

setWrapper

public void setWrapper(ServletWrapper handler)
Specified by:
setWrapper in interface Request

getContainer

public Container getContainer()
Specified by:
getContainer in interface Request

setContainer

public void setContainer(Container container)
Specified by:
setContainer in interface Request

getMappedPath

public java.lang.String getMappedPath()
The file - result of mapping the request ( using aliases and other mapping rules. Usefull only for static resources.
Specified by:
getMappedPath in interface Request

setMappedPath

public void setMappedPath(java.lang.String m)
Specified by:
setMappedPath in interface Request

setRequestURI

public void setRequestURI(java.lang.String r)
Specified by:
setRequestURI in interface Request

setParameters

public void setParameters(java.util.Hashtable h)
Specified by:
setParameters in interface Request

getParameters

public java.util.Hashtable getParameters()
Specified by:
getParameters in interface Request

setContentLength

public void setContentLength(int len)
Specified by:
setContentLength in interface Request

setContentType

public void setContentType(java.lang.String type)
Specified by:
setContentType in interface Request

setCharEncoding

public void setCharEncoding(java.lang.String enc)
Specified by:
setCharEncoding in interface Request

setAuthType

public void setAuthType(java.lang.String authType)
Specified by:
setAuthType in interface Request

setPathInfo

public void setPathInfo(java.lang.String pathInfo)
Specified by:
setPathInfo in interface Request

setQueryString

public void setQueryString(java.lang.String queryString)
Set query string - will be called by forward
Specified by:
setQueryString in interface Request

setSession

public void setSession(javax.servlet.http.HttpSession serverSession)
Specified by:
setSession in interface Request

setServletPath

public void setServletPath(java.lang.String servletPath)
Description copied from interface: Request
Servlet Path
Specified by:
setServletPath in interface Request

setServerName

public void setServerName(java.lang.String serverName)
Virtual host
Specified by:
setServerName in interface Request

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
Specified by:
getAttribute in interface Request

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value)
Specified by:
setAttribute in interface Request

removeAttribute

public void removeAttribute(java.lang.String name)
Specified by:
removeAttribute in interface Request

getAttributeNames

public java.util.Enumeration getAttributeNames()
Specified by:
getAttributeNames in interface Request

getHeaders

public java.util.Enumeration getHeaders(java.lang.String name)
Specified by:
getHeaders in interface Request

getReader

public java.io.BufferedReader getReader()
                                 throws java.io.IOException
Specified by:
getReader in interface Request

recycle

public void recycle()
Description copied from interface: Request
Support for "pools"
Specified by:
recycle in interface Request

getMimeHeaders

public org.apache.tomcat.util.MimeHeaders getMimeHeaders()

getHeader

public java.lang.String getHeader(java.lang.String name)
Specified by:
getHeader in interface Request

getHeaderNames

public java.util.Enumeration getHeaderNames()
Specified by:
getHeaderNames in interface Request

getInputStream

public javax.servlet.ServletInputStream getInputStream()
                                                throws java.io.IOException
Specified by:
getInputStream in interface Request

getServerPort

public int getServerPort()
Specified by:
getServerPort in interface Request

getRemoteAddr

public java.lang.String getRemoteAddr()
Specified by:
getRemoteAddr in interface Request

getRemoteHost

public java.lang.String getRemoteHost()
Description copied from interface: Request
Expensive - should be implemented as a callback where possible!
Specified by:
getRemoteHost in interface Request

doRead

public int doRead(byte[] b,
                  int off,
                  int len)
           throws java.io.IOException
Fill in the buffer. This method is probably easier to implement than previous. This method should only be called from SerlvetInputStream implementations. No need to implement it if your adapter implements ServletInputStream.

doRead

public int doRead()
           throws java.io.IOException

getServletPrefix

public java.lang.String getServletPrefix()

setScheme

public void setScheme(java.lang.String scheme)

setMethod

public void setMethod(java.lang.String method)

setProtocol

public void setProtocol(java.lang.String protocol)

setMimeHeaders

public void setMimeHeaders(org.apache.tomcat.util.MimeHeaders headers)

setBody

public void setBody(java.lang.StringBuffer body)

setServerPort

public void setServerPort(int serverPort)

setRemoteAddr

public void setRemoteAddr(java.lang.String remoteAddr)

setRemoteHost

public void setRemoteHost(java.lang.String remoteHost)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toStringDebug

public java.lang.String toStringDebug()


Copyright © 2000 Apache Software Foundation. All Rights Reserved.