Save This Page
Home » apache-tomcat-6.0.16-src » org.apache » coyote » tomcat4 » [javadoc | source]
org.apache.coyote.tomcat4
public class: CoyoteRequest [javadoc | source]
java.lang.Object
   org.apache.coyote.tomcat4.CoyoteRequest

All Implemented Interfaces:
    HttpServletRequest, org.apache.catalina.HttpRequest

Wrapper object for the Coyote request.
Nested Class Summary:
protected class  CoyoteRequest.PrivilegedGetSession   
Field Summary
protected  Request coyoteRequest    Coyote request. 
protected static  StringManager sm    The string manager for this package. 
protected  Cookie[] cookies    The set of cookies associated with this Request. 
protected  SimpleDateFormat[] formats    The set of SimpleDateFormat formats to use in getDateHeader(). 
protected static  Locale defaultLocale    The default Locale if none are specified. 
protected  HashMap attributes    The attributes associated with this Request, keyed by attribute name. 
protected  ArrayList locales    The preferred Locales assocaited with this Request. 
protected  String authType    Authentication type. 
protected  BufferedReader reader    Reader. Note: At the moment, no attempt is being made at recycling the reader, but this could be implemented in the future, using a design like the one used for the output buffer. 
protected  CoyoteInputStream inputStream    ServletInputStream. 
protected  boolean usingInputStream    Using stream flag. 
protected  boolean usingReader    Using writer flag. 
protected  String contextPath    Context path. 
protected  String pathInfo    Path info. 
protected  String servletPath    Servlet path. 
protected  Principal userPrincipal    User principal. 
protected  boolean sessionParsed    Session parsed flag. 
protected  boolean requestParametersParsed    Request parameters parsed flag. 
protected  boolean secure    Secure flag. 
protected static  int CACHED_POST_LEN    Post data buffer. 
protected  byte[] postData     
protected  ParameterMap parameterMap    Hash map used in the getParametersMap method. 
protected  Session session    The currently active session for this request. 
protected  boolean requestedSessionCookie    Was the requested session ID received in a cookie? 
protected  String requestedSessionId    The requested session ID (if any) for this request. 
protected  boolean requestedSessionURL    Was the requested session ID received in a URL? 
protected  Socket socket    The socket through which this Request was received. 
protected  boolean localesParsed    Parse locales. 
protected  String remoteAddr    Remote address. 
protected  String remoteHost    Remote host. 
protected  String authorization    The authorization credentials sent with this Request. 
protected  CoyoteConnector connector    Associated Catalina connector. 
protected  Context context    The Context within which this Request is being processed. 
protected static final  String info    Descriptive information about this Request implementation. 
protected  CoyoteRequestFacade facade    The facade associated with this request. 
protected  Response response    The response with which this request is associated. 
protected  B2CConverter URIConverter    URI byte to char converter (not recycled). 
protected  Wrapper wrapper    The Wrapper within which this Request is being processed. 
Method from org.apache.coyote.tomcat4.CoyoteRequest Summary:
addCookie,   addHeader,   addLocale,   addParameter,   clearCookies,   clearHeaders,   clearLocales,   clearParameters,   createInputStream,   doGetSession,   finishRequest,   getAttribute,   getAttributeNames,   getAuthType,   getAuthorization,   getCharacterEncoding,   getConnector,   getContentLength,   getContentType,   getContext,   getContextPath,   getCookies,   getCoyoteRequest,   getDateHeader,   getDecodedRequestURI,   getHeader,   getHeaderNames,   getHeaders,   getInfo,   getInputStream,   getIntHeader,   getLocale,   getLocales,   getMethod,   getNote,   getNoteNames,   getParameter,   getParameterMap,   getParameterNames,   getParameterValues,   getPathInfo,   getPathTranslated,   getProtocol,   getQueryString,   getReader,   getRealPath,   getRemoteAddr,   getRemoteHost,   getRemoteUser,   getRequest,   getRequestDispatcher,   getRequestURI,   getRequestURL,   getRequestedSessionId,   getResponse,   getScheme,   getServerName,   getServerPort,   getServletPath,   getSession,   getSession,   getSocket,   getStream,   getURIConverter,   getUserPrincipal,   getWrapper,   isRequestedSessionIdFromCookie,   isRequestedSessionIdFromURL,   isRequestedSessionIdFromUrl,   isRequestedSessionIdValid,   isSecure,   isUserInRole,   parseLocales,   parseLocalesHeader,   parseRequestParameters,   readPostBody,   recycle,   removeAttribute,   removeNote,   setAttribute,   setAuthType,   setAuthorization,   setCharacterEncoding,   setConnector,   setContentLength,   setContentType,   setContext,   setContextPath,   setCookies,   setCoyoteRequest,   setDecodedRequestURI,   setMethod,   setNote,   setPathInfo,   setProtocol,   setQueryString,   setRemoteAddr,   setRemoteHost,   setRequestURI,   setRequestedSessionCookie,   setRequestedSessionId,   setRequestedSessionURL,   setResponse,   setScheme,   setSecure,   setServerName,   setServerPort,   setServletPath,   setSocket,   setStream,   setURIConverter,   setUserPrincipal,   setWrapper
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.coyote.tomcat4.CoyoteRequest Detail:
 public  void addCookie(Cookie cookie) 
    Add a Cookie to the set of Cookies associated with this Request.
 public  void addHeader(String name,
    String value) 
    Add a Header to the set of Headers associated with this Request.
 public  void addLocale(Locale locale) 
    Add a Locale to the set of preferred Locales for this Request. The first added Locale will be the first one returned by getLocales().
 public  void addParameter(String name,
    String[] values) 
    Add a parameter name and corresponding set of values to this Request. (This is used when restoring the original request on a form based login).
 public  void clearCookies() 
    Clear the collection of Cookies associated with this Request.
 public  void clearHeaders() 
    Clear the collection of Headers associated with this Request.
 public  void clearLocales() 
    Clear the collection of Locales associated with this Request.
 public  void clearParameters() 
    Clear the collection of parameters associated with this Request.
 public ServletInputStream createInputStream() throws IOException 
    Create and return a ServletInputStream to read the content associated with this Request.
 protected HttpSession doGetSession(boolean create) 
 public  void finishRequest() throws IOException 
    Perform whatever actions are required to flush and close the input stream or reader, in a single operation.
 public Object getAttribute(String name) 
    Return the specified request attribute if it exists; otherwise, return null.
 public Enumeration getAttributeNames() 
    Return the names of all request attributes for this Request, or an empty Enumeration if there are none.
 public String getAuthType() 
    Return the authentication type used for this Request.
 public String getAuthorization() 
    Return the authorization credentials sent with this request.
 public String getCharacterEncoding() 
    Return the character encoding for this Request.
 public Connector getConnector() 
    Return the Connector through which this Request was received.
 public int getContentLength() 
    Return the content length for this Request.
 public String getContentType() 
    Return the content type for this Request.
 public Context getContext() 
    Return the Context within which this Request is being processed.
 public String getContextPath() 
    Return the portion of the request URI used to select the Context of the Request.
 public Cookie[] getCookies() 
    Return the set of Cookies received with this Request.
 public Request getCoyoteRequest() 
    Get the Coyote request.
 public long getDateHeader(String name) 
    Return the value of the specified date header, if any; otherwise return -1.
 public String getDecodedRequestURI() 
    Get the decoded request URI.
 public String getHeader(String name) 
    Return the first value of the specified header, if any; otherwise, return null
 public Enumeration getHeaderNames() 
    Return the names of all headers received with this request.
 public Enumeration getHeaders(String name) 
    Return all of the values of the specified header, if any; otherwise, return an empty enumeration.
 public String getInfo() 
    Return descriptive information about this Request implementation and the corresponding version number, in the format <description>/<version>.
 public ServletInputStream getInputStream() throws IOException 
    Return the servlet input stream for this Request. The default implementation returns a servlet input stream created by createInputStream().
 public int getIntHeader(String name) 
    Return the value of the specified header as an integer, or -1 if there is no such header for this request.
 public Locale getLocale() 
    Return the preferred Locale that the client will accept content in, based on the value for the first Accept-Language header that was encountered. If the request did not specify a preferred language, the server's default Locale is returned.
 public Enumeration getLocales() 
    Return the set of preferred Locales that the client will accept content in, based on the values for any Accept-Language headers that were encountered. If the request did not specify a preferred language, the server's default Locale is returned.
 public String getMethod() 
    Return the HTTP request method used in this Request.
 public Object getNote(String name) 
    Return the object bound with the specified name to the internal notes for this request, or null if no such binding exists.
 public Iterator getNoteNames() 
    Return an Iterator containing the String names of all notes bindings that exist for this request.
 public String getParameter(String name) 
    Return the value of the specified request parameter, if any; otherwise, return null. If there is more than one value defined, return only the first one.
 public Map getParameterMap() 
    Returns a Map of the parameters of this request. Request parameters are extra information sent with the request. For HTTP servlets, parameters are contained in the query string or posted form data.
 public Enumeration getParameterNames() 
    Return the names of all defined request parameters for this request.
 public String[] getParameterValues(String name) 
    Return the defined values for the specified request parameter, if any; otherwise, return null.
 public String getPathInfo() 
    Return the path information associated with this Request.
 public String getPathTranslated() 
    Return the extra path information for this request, translated to a real path.
 public String getProtocol() 
    Return the protocol and version used to make this Request.
 public String getQueryString() 
    Return the query string associated with this request.
 public BufferedReader getReader() throws IOException 
    Read the Reader wrapping the input stream for this Request. The default implementation wraps a BufferedReader around the servlet input stream returned by createInputStream().
 public String getRealPath(String path) 
Deprecated! As - of version 2.1 of the Java Servlet API, use ServletContext.getRealPath().

    Return the real path of the specified virtual path.
 public String getRemoteAddr() 
    Return the remote IP address making this Request.
 public String getRemoteHost() 
    Return the remote host name making this Request.
 public String getRemoteUser() 
    Return the name of the remote user that has been authenticated for this Request.
 public ServletRequest getRequest() 
    Return the ServletRequest for which this object is the facade. This method must be implemented by a subclass.
 public RequestDispatcher getRequestDispatcher(String path) 
    Return a RequestDispatcher that wraps the resource at the specified path, which may be interpreted as relative to the current request path.
 public String getRequestURI() 
    Return the request URI for this request.
 public StringBuffer getRequestURL() 
    Reconstructs the URL the client used to make the request. The returned URL contains a protocol, server name, port number, and server path, but it does not include query string parameters.

    Because this method returns a StringBuffer, not a String, you can modify the URL easily, for example, to append query parameters.

    This method is useful for creating redirect messages and for reporting errors.

 public String getRequestedSessionId() 
    Return the session identifier included in this request, if any.
 public Response getResponse() 
    Return the Response with which this Request is associated.
 public String getScheme() 
    Return the scheme used to make this Request.
 public String getServerName() 
    Return the server name responding to this Request.
 public int getServerPort() 
    Return the server port responding to this Request.
 public String getServletPath() 
    Return the portion of the request URI used to select the servlet that will process this request.
 public HttpSession getSession() 
    Return the session associated with this Request, creating one if necessary.
 public HttpSession getSession(boolean create) 
    Return the session associated with this Request, creating one if necessary and requested.
 public Socket getSocket() 
    Return the Socket (if any) through which this Request was received. This should only be used to access underlying state information about this Socket, such as the SSLSession associated with an SSLSocket.
 public InputStream getStream() 
    Return the input stream associated with this Request.
 protected B2CConverter getURIConverter() 
    Return the URI converter.
 public Principal getUserPrincipal() 
    Return the principal that has been authenticated for this Request.
 public Wrapper getWrapper() 
    Return the Wrapper within which this Request is being processed.
 public boolean isRequestedSessionIdFromCookie() 
    Return true if the session identifier included in this request came from a cookie.
 public boolean isRequestedSessionIdFromURL() 
    Return true if the session identifier included in this request came from the request URI.
 public boolean isRequestedSessionIdFromUrl() 
Deprecated! As - of Version 2.1 of the Java Servlet API, use isRequestedSessionIdFromURL() instead.

    Return true if the session identifier included in this request came from the request URI.
 public boolean isRequestedSessionIdValid() 
    Return true if the session identifier included in this request identifies a valid session.
 public boolean isSecure() 
    Was this request received on a secure connection?
 public boolean isUserInRole(String role) 
    Return true if the authenticated user principal possesses the specified role name.
 protected  void parseLocales() 
    Parse request locales.
 protected  void parseLocalesHeader(String value) 
    Parse accept-language header value.
 protected  void parseRequestParameters() 
    Parse request parameters.
 protected int readPostBody(byte[] body,
    int len) throws IOException 
    Read post body in an array.
 public  void recycle() 
    Release all object references, and initialize instance variables, in preparation for reuse of this object.
 public  void removeAttribute(String name) 
    Remove the specified request attribute if it exists.
 public  void removeNote(String name) 
    Remove any object bound to the specified name in the internal notes for this request.
 public  void setAttribute(String name,
    Object value) 
    Set the specified request attribute to the specified value.
 public  void setAuthType(String type) 
    Set the authentication type used for this request, if any; otherwise set the type to null. Typical values are "BASIC", "DIGEST", or "SSL".
 public  void setAuthorization(String authorization) 
    Set the authorization credentials sent with this request.
 public  void setCharacterEncoding(String enc) throws UnsupportedEncodingException 
    Overrides the name of the character encoding used in the body of this request. This method must be called prior to reading request parameters or reading input using getReader().
 public  void setConnector(Connector connector) 
    Set the Connector through which this Request was received.
 public  void setContentLength(int length) 
    Set the content length associated with this Request.
 public  void setContentType(String type) 
    Set the content type (and optionally the character encoding) associated with this Request. For example, text/html; charset=ISO-8859-4.
 public  void setContext(Context context) 
    Set the Context within which this Request is being processed. This must be called as soon as the appropriate Context is identified, because it identifies the value to be returned by getContextPath(), and thus enables parsing of the request URI.
 public  void setContextPath(String path) 
    Set the context path for this Request. This will normally be called when the associated Context is mapping the Request to a particular Wrapper.
 public  void setCookies(Cookie[] cookies) 
    Set the set of cookies recieved with this Request.
 public  void setCoyoteRequest(Request coyoteRequest) 
    Set the Coyote request.
 public  void setDecodedRequestURI(String uri) 
    Set the decoded request URI.
 public  void setMethod(String method) 
    Set the HTTP request method used for this Request.
 public  void setNote(String name,
    Object value) 
    Bind an object to a specified name in the internal notes associated with this request, replacing any existing binding for this name.
 public  void setPathInfo(String path) 
    Set the path information for this Request. This will normally be called when the associated Context is mapping the Request to a particular Wrapper.
 public  void setProtocol(String protocol) 
    Set the protocol name and version associated with this Request.
 public  void setQueryString(String query) 
    Set the query string for this Request. This will normally be called by the HTTP Connector, when it parses the request headers.
 public  void setRemoteAddr(String remoteAddr) 
    Set the IP address of the remote client associated with this Request.
 public  void setRemoteHost(String remoteHost) 
    Set the fully qualified name of the remote client associated with this Request.
 public  void setRequestURI(String uri) 
    Set the unparsed request URI for this Request. This will normally be called by the HTTP Connector, when it parses the request headers.
 public  void setRequestedSessionCookie(boolean flag) 
    Set a flag indicating whether or not the requested session ID for this request came in through a cookie. This is normally called by the HTTP Connector, when it parses the request headers.
 public  void setRequestedSessionId(String id) 
    Set the requested session ID for this request. This is normally called by the HTTP Connector, when it parses the request headers.
 public  void setRequestedSessionURL(boolean flag) 
    Set a flag indicating whether or not the requested session ID for this request came in through a URL. This is normally called by the HTTP Connector, when it parses the request headers.
 public  void setResponse(Response response) 
    Set the Response with which this Request is associated.
 public  void setScheme(String scheme) 
    Set the name of the scheme associated with this request. Typical values are http, https, and ftp.
 public  void setSecure(boolean secure) 
    Set the value to be returned by isSecure() for this Request.
 public  void setServerName(String name) 
    Set the name of the server (virtual host) to process this request.
 public  void setServerPort(int port) 
    Set the port number of the server to process this request.
 public  void setServletPath(String path) 
    Set the servlet path for this Request. This will normally be called when the associated Context is mapping the Request to a particular Wrapper.
 public  void setSocket(Socket socket) 
    Set the Socket (if any) through which this Request was received.
 public  void setStream(InputStream stream) 
    Set the input stream associated with this Request.
 protected  void setURIConverter(B2CConverter URIConverter) 
    Set the URI converter.
 public  void setUserPrincipal(Principal principal) 
    Set the Principal who has been authenticated for this Request. This value is also used to calculate the value to be returned by the getRemoteUser() method.
 public  void setWrapper(Wrapper wrapper) 
    Set the Wrapper within which this Request is being processed. This must be called as soon as the appropriate Wrapper is identified, and before the Request is ultimately passed to an application servlet.