org.glassfish.grizzly.http.server
Class Request

java.lang.Object
  extended by org.glassfish.grizzly.http.server.Request

public class Request
extends java.lang.Object

Wrapper object for the Coyote request.

Version:
$Revision: 1.2 $ $Date: 2007/03/14 02:15:42 $
Author:
Remy Maucherat, Craig R. McClanahan

Field Summary
protected  java.util.List<AfterServiceListener> afterServicesList
           
protected static int CACHED_POST_LEN
          Post data buffer.
protected  Cookie[] cookies
          The set of cookies associated with this Request.
protected  boolean cookiesParsed
          Cookies parsed flag.
protected  FilterChainContext ctx
           
protected static java.util.Locale defaultLocale
          The default Locale if none are specified.
protected  java.lang.Object dispatcherType
          The current dispatcher type.
protected  HttpServerFilter httpServerFilter
           
protected  InputBuffer inputBuffer
          The associated input buffer.
protected  java.util.ArrayList<java.util.Locale> locales
          The preferred Locales associated with this Request.
protected  boolean localesParsed
          Parse locales.
protected  ParameterMap parameterMap
          Hash map used in the getParametersMap method.
protected  Parameters parameters
           
protected  byte[] postData
           
protected  Cookies rawCookies
           
protected  HttpRequestPacket request
          HTTP Request Packet
protected  java.lang.Object requestDispatcherPath
          The current request dispatcher path.
protected  boolean requestedSessionCookie
          Was the requested session ID received in a cookie?
protected  java.lang.String requestedSessionId
          The requested session ID (if any) for this request.
protected  boolean requestedSessionURL
          Was the requested session ID received in a URL?
protected  boolean requestParametersParsed
          Request parameters parsed flag.
protected  Response response
          The response with which this request is associated.
protected  boolean secure
          Secure flag.
protected  boolean sessionParsed
          Session parsed flag.
protected  javax.security.auth.Subject subject
          The Subject associated with the current AccessControllerContext
protected  java.security.Principal userPrincipal
          User principal.
protected  boolean usingInputStream
          Using stream flag.
protected  boolean usingReader
          Using writer flag.
 
Constructor Summary
protected Request()
           
 
Method Summary
 void addAfterServiceListener(AfterServiceListener listener)
          Add the listener, which will be notified, once Request processing will be finished.
 void addCookie(Cookie cookie)
          Add a Cookie to the set of Cookies associated with this Request.
 void addLocale(java.util.Locale locale)
          Add a Locale to the set of preferred Locales for this Request.
 void addParameter(java.lang.String name, java.lang.String[] values)
          Add a parameter name and corresponding set of values to this Request.
static java.lang.StringBuffer appendRequestURL(Request request, java.lang.StringBuffer buffer)
          Appends the reconstructed URL the client used to make the request.
static java.lang.StringBuilder appendRequestURL(Request request, java.lang.StringBuilder buffer)
          Appends the reconstructed URL the client used to make the request.
 boolean asyncInput()
           
 void clearCookies()
          Clear the collection of Cookies associated with this Request.
 void clearHeaders()
          Clear the collection of Headers associated with this Request.
 void clearLocales()
          Clear the collection of Locales associated with this Request.
 void clearParameters()
          Clear the collection of parameters associated with this Request.
protected  void configureSessionCookie(Cookie cookie)
          Configures the given JSESSIONID cookie.
static Request create()
           
 NIOInputStream createInputStream()
          Create and return a NIOInputStream to read the content associated with this Request.
static
<E> Note<E>
createNote(java.lang.String name)
          Create a named Note associated with this Request.
 int decrementDispatchDepth()
          Decrement the depth of application dispatch
protected  Session doGetSession(boolean create)
           
 java.lang.Object getAttribute(java.lang.String name)
          Return the specified request attribute if it exists; otherwise, return null.
 java.util.Set<java.lang.String> getAttributeNames()
          Return the names of all request attributes for this Request, or an empty Set if there are none.
 java.lang.String getAuthorization()
          Return the authorization credentials sent with this request.
 java.lang.String getAuthType()
          Return the authentication type used for this Request.
 java.lang.String getCharacterEncoding()
          Return the character encoding for this Request.
 int getContentLength()
          Return the content length for this Request.
 long getContentLengthLong()
          Return the content length for this Request represented by Java long type.
 java.lang.String getContentType()
          Return the content type for this Request.
 FilterChainContext getContext()
           
 java.lang.String getContextPath()
          Returns the portion of the request URI that indicates the context of the request.
 Cookie[] getCookies()
          Return the set of Cookies received with this Request.
 long getDateHeader(Header header)
          Return the value of the specified date header, if any; otherwise return -1.
 long getDateHeader(java.lang.String name)
          Return the value of the specified date header, if any; otherwise return -1.
 java.lang.String getDecodedRequestURI()
          Get the decoded request URI.
 java.lang.String getHeader(Header header)
          Return the first value of the specified header, if any; otherwise, return null
 java.lang.String getHeader(java.lang.String name)
          Return the first value of the specified header, if any; otherwise, return null
 java.lang.Iterable<java.lang.String> getHeaderNames()
          Return the names of all headers received with this request.
 java.lang.Iterable<java.lang.String> getHeaders(Header header)
          Return all of the values of the specified header, if any; otherwise, return an empty enumeration.
 java.lang.Iterable<java.lang.String> getHeaders(java.lang.String name)
          Return all of the values of the specified header, if any; otherwise, return an empty enumeration.
 InputBuffer getInputBuffer()
           
 NIOInputStream getInputStream()
           Return the NIOInputStream for this Request.
 NIOInputStream getInputStream(boolean blocking)
           Return the NIOInputStream for this Request.
 int getIntHeader(Header header)
          Return the value of the specified header as an integer, or -1 if there is no such header for this request.
 int getIntHeader(java.lang.String name)
          Return the value of the specified header as an integer, or -1 if there is no such header for this request.
 java.lang.String getJrouteId()
          Gets the jroute id of this request, which may have been sent as a separate JROUTE cookie or appended to the session identifier encoded in the URI (if cookies have been disabled).
 java.lang.String getLocalAddr()
          Returns the Internet Protocol (IP) address of the interface on which the request was received.
 java.util.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.
 java.util.List<java.util.Locale> 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.
 java.lang.String getLocalName()
          Returns the host name of the Internet Protocol (IP) interface on which the request was received.
 int getLocalPort()
          Returns the Internet Protocol (IP) port number of the interface on which the request was received.
static int getMaxDispatchDepth()
           
 Method getMethod()
          Return the HTTP request method used in this Request.
<E> E
getNote(Note<E> note)
          Return the Note value associated with this Request, or null if no such binding exists.
 java.util.Set<java.lang.String> getNoteNames()
          Return a Set containing the String names of all note bindings that exist for this request.
 java.lang.String getParameter(java.lang.String name)
          Return the value of the specified request parameter, if any; otherwise, return null.
 java.util.Map<java.lang.String,java.lang.String[]> getParameterMap()
          Returns a Map of the parameters of this request.
 java.util.Set<java.lang.String> getParameterNames()
          Return the names of all defined request parameters for this request.
 java.lang.String[] getParameterValues(java.lang.String name)
          Return the defined values for the specified request parameter, if any; otherwise, return null.
 Buffer getPostBody(int len)
          Gets the POST body of this request.
 Protocol getProtocol()
          Return the protocol and version used to make this Request.
 java.lang.String getQueryString()
          Return the query string associated with this request.
protected  Cookies getRawCookies()
          TODO DOCS
 NIOReader getReader()
           Returns the NIOReader associated with this Request.
 NIOReader getReader(boolean blocking)
           Returns the NIOReader associated with this Request.
 java.lang.String getRemoteAddr()
          Return the remote IP address making this Request.
 java.lang.String getRemoteHost()
          Return the remote host name making this Request.
 int getRemotePort()
          Returns the Internet Protocol (IP) source port of the client or last proxy that sent the request.
 java.lang.String getRemoteUser()
          Return the name of the remote user that has been authenticated for this Request.
 HttpRequestPacket getRequest()
          Get the Coyote request.
 java.lang.String getRequestedSessionId()
          Return the session identifier included in this request, if any.
 java.lang.String getRequestURI()
          Return the request URI for this request.
 java.lang.StringBuilder getRequestURL()
          Reconstructs the URL the client used to make the request.
 Response getResponse()
          Return the Response with which this Request is associated.
 java.lang.String getScheme()
          Return the scheme used to make this Request.
 java.lang.String getServerName()
          Return the server name responding to this Request.
 int getServerPort()
          Return the server port responding to this Request.
 Session getSession()
          Return the session associated with this Request, creating one if necessary.
 Session getSession(boolean create)
          Return the session associated with this Request, creating one if necessary and requested.
 java.security.Principal getUserPrincipal()
          Return the principal that has been authenticated for this Request.
 int incrementDispatchDepth()
          Increment the depth of application dispatch
 void initialize(Response response, HttpRequestPacket request, FilterChainContext ctx, HttpServerFilter httpServerFilter)
           
 void initiateAsyncronousDataReceiving()
          Initiates asynchronous data receiving.
 boolean isMaxDispatchDepthReached()
          Check if the application dispatching has reached the maximum
 boolean isRequestedSessionIdFromCookie()
          Return true if the session identifier included in this request came from a cookie.
 boolean isRequestedSessionIdFromURL()
          Return true if the session identifier included in this request came from the request URI.
 boolean isRequestedSessionIdValid()
          Return true if the session identifier included in this request identifies a valid session.
 boolean isSecure()
          Was this request received on a secure connection?
protected  void onAfterService()
           
protected  void parseCookies()
          Parse cookies.
protected  void parseLocales()
          Parse request locales.
protected  void parseLocalesHeader(java.lang.String value)
          Parse accept-language header value.
protected  void parseRequestParameters()
          Parse request parameters.
protected  void parseSessionId()
          Parse session id in URL.
protected  void recycle()
          Release all object references, and initialize instance variables, in preparation for reuse of this object.
 void removeAfterServiceListener(AfterServiceListener listener)
          Remove the "after-service" listener, which was previously added by addAfterServiceListener(org.glassfish.grizzly.http.server.AfterServiceListener).
 void removeAttribute(java.lang.String name)
          Remove the specified request attribute if it exists.
<E> E
removeNote(Note<E> note)
          Remove the Note value associated with this request.
 boolean requiresAcknowledgement()
           
 void setAttribute(java.lang.String name, java.lang.Object value)
          Set the specified request attribute to the specified value.
 void setCharacterEncoding(java.lang.String encoding)
          Overrides the name of the character encoding used in the body of this request.
protected  void setContextPath(java.lang.String contextPath)
           
 void setCookies(Cookie[] cookies)
          Set the set of cookies received with this Request.
static void setMaxDispatchDepth(int depth)
          Static setter method for the maximum dispatch depth
 void setMethod(java.lang.String method)
          Sets the HTTP request method used in this Request.
<E> void
setNote(Note<E> note, E value)
          Bind the Note value to this Request, replacing any existing binding for this name.
 void setQueryString(java.lang.String queryString)
          Sets the query string associated with this request.
 void setRequestedSessionCookie(boolean flag)
          Set a flag indicating whether or not the requested session ID for this request came in through a cookie.
 void setRequestedSessionId(java.lang.String id)
          Set the requested session ID for this request.
 void setRequestedSessionURL(boolean flag)
          Set a flag indicating whether or not the requested session ID for this request came in through a URL.
 void setRequestURI(java.lang.String uri)
          Sets the request URI for this request.
 void setServerName(java.lang.String name)
          Set the name of the server (virtual host) to process this request.
 void setServerPort(int port)
          Set the port number of the server to process this request.
 void setUserPrincipal(java.security.Principal principal)
          Set the Principal who has been authenticated for this Request.
protected  void skipPostBody(int len)
          Skips the POST body of this request.
protected  java.lang.String unescape(java.lang.String s)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

request

protected HttpRequestPacket request
HTTP Request Packet


ctx

protected FilterChainContext ctx

httpServerFilter

protected HttpServerFilter httpServerFilter

afterServicesList

protected final java.util.List<AfterServiceListener> afterServicesList

cookies

protected Cookie[] cookies
The set of cookies associated with this Request.


rawCookies

protected Cookies rawCookies

defaultLocale

protected static final java.util.Locale defaultLocale
The default Locale if none are specified.


locales

protected final java.util.ArrayList<java.util.Locale> locales
The preferred Locales associated with this Request.


dispatcherType

protected java.lang.Object dispatcherType
The current dispatcher type.


inputBuffer

protected final InputBuffer inputBuffer
The associated input buffer.


usingInputStream

protected boolean usingInputStream
Using stream flag.


usingReader

protected boolean usingReader
Using writer flag.


userPrincipal

protected java.security.Principal userPrincipal
User principal.


sessionParsed

protected boolean sessionParsed
Session parsed flag.


requestParametersParsed

protected boolean requestParametersParsed
Request parameters parsed flag.


cookiesParsed

protected boolean cookiesParsed
Cookies parsed flag.


secure

protected boolean secure
Secure flag.


subject

protected javax.security.auth.Subject subject
The Subject associated with the current AccessControllerContext


CACHED_POST_LEN

protected static final int CACHED_POST_LEN
Post data buffer.

See Also:
Constant Field Values

postData

protected byte[] postData

parameterMap

protected final ParameterMap parameterMap
Hash map used in the getParametersMap method.


parameters

protected final Parameters parameters

requestDispatcherPath

protected java.lang.Object requestDispatcherPath
The current request dispatcher path.


requestedSessionCookie

protected boolean requestedSessionCookie
Was the requested session ID received in a cookie?


requestedSessionId

protected java.lang.String requestedSessionId
The requested session ID (if any) for this request.


requestedSessionURL

protected boolean requestedSessionURL
Was the requested session ID received in a URL?


localesParsed

protected boolean localesParsed
Parse locales.


response

protected Response response
The response with which this request is associated.

Constructor Detail

Request

protected Request()
Method Detail

create

public static Request create()

initialize

public void initialize(Response response,
                       HttpRequestPacket request,
                       FilterChainContext ctx,
                       HttpServerFilter httpServerFilter)

getRequest

public HttpRequestPacket getRequest()
Get the Coyote request.


getResponse

public Response getResponse()
Return the Response with which this Request is associated.


addAfterServiceListener

public void addAfterServiceListener(AfterServiceListener listener)
Add the listener, which will be notified, once Request processing will be finished.

Parameters:
listener - the listener, which will be notified, once Request processing will be finished.

removeAfterServiceListener

public void removeAfterServiceListener(AfterServiceListener listener)
Remove the "after-service" listener, which was previously added by addAfterServiceListener(org.glassfish.grizzly.http.server.AfterServiceListener).

Parameters:
listener - the "after-service" listener, which was previously added by addAfterServiceListener(org.glassfish.grizzly.http.server.AfterServiceListener).

onAfterService

protected void onAfterService()

recycle

protected final void recycle()
Release all object references, and initialize instance variables, in preparation for reuse of this object.


getAuthorization

public java.lang.String getAuthorization()
Return the authorization credentials sent with this request.


createInputStream

public NIOInputStream createInputStream()
Create and return a NIOInputStream to read the content associated with this Request.

Throws:
java.io.IOException - if an input/output error occurs

createNote

public static <E> Note<E> createNote(java.lang.String name)
Create a named Note associated with this Request.

Type Parameters:
E - the Note type.
Parameters:
name - the Note name.
Returns:
the Note.

getNote

public <E> E getNote(Note<E> note)
Return the Note value associated with this Request, or null if no such binding exists. Use createNote(java.lang.String) to create a new Note.

Parameters:
note - Note value to be returned

getNoteNames

public java.util.Set<java.lang.String> getNoteNames()
Return a Set containing the String names of all note bindings that exist for this request. Use createNote(java.lang.String) to create a new Note.

Returns:
a Set containing the String names of all note bindings that exist for this request.

removeNote

public <E> E removeNote(Note<E> note)
Remove the Note value associated with this request. Use createNote(java.lang.String) to create a new Note.

Parameters:
note - Note value to be removed

setNote

public <E> void setNote(Note<E> note,
                        E value)
Bind the Note value to this Request, replacing any existing binding for this name. Use createNote(java.lang.String) to create a new Note.

Parameters:
note - Note to which the object should be bound
value - the Note value be bound to the specified Note.

setServerName

public void setServerName(java.lang.String name)
Set the name of the server (virtual host) to process this request.

Parameters:
name - The server name

setServerPort

public void setServerPort(int port)
Set the port number of the server to process this request.

Parameters:
port - The server port

getContextPath

public java.lang.String getContextPath()
Returns the portion of the request URI that indicates the context of the request. The context path always comes first in a request URI. The path starts with a "/" character but does not end with a "/" character. For HttpHandlers in the default (root) context, this method returns "". The container does not decode this string.

Returns:
a String specifying the portion of the request URI that indicates the context of the request

setContextPath

protected void setContextPath(java.lang.String contextPath)

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
Return the specified request attribute if it exists; otherwise, return null.

Parameters:
name - Name of the request attribute to return

getAttributeNames

public java.util.Set<java.lang.String> getAttributeNames()
Return the names of all request attributes for this Request, or an empty Set if there are none.


getCharacterEncoding

public java.lang.String getCharacterEncoding()
Return the character encoding for this Request.


getContentLength

public int getContentLength()
Return the content length for this Request.


getContentLengthLong

public long getContentLengthLong()
Return the content length for this Request represented by Java long type.


getContentType

public java.lang.String getContentType()
Return the content type for this Request.


getInputStream

public NIOInputStream getInputStream()

Return the NIOInputStream for this Request. This stream will not block when reading content.

NOTE: For now, in order to use non-blocking functionality, this method must be invoked before the HttpHandler.service(Request, Response) method returns. We hope to have this addressed in the next release.

Returns:
the NIOInputStream for this Request.
Throws:
java.lang.IllegalStateException - if getReader(boolean) or getReader() has already been called for this request.
Since:
2.1.2
See Also:
getInputStream(boolean)

getInputStream

public NIOInputStream getInputStream(boolean blocking)

Return the NIOInputStream for this Request.

NOTE: For now, in order to use non-blocking functionality, this method must be invoked before the HttpHandler.service(Request, Response) method returns. We hope to have this addressed in the next release.

Parameters:
blocking - if true, the NIOInputStream will only be usable in blocking mode.
Returns:
the NIOInputStream for this Request.
Throws:
java.lang.IllegalStateException - if getReader(boolean) or getReader() has already been called for this request.

asyncInput

public boolean asyncInput()
Returns:
true if getInputStream(boolean) or getReader(boolean) were invoked with an argument value of true

requiresAcknowledgement

public boolean requiresAcknowledgement()
Returns:
true if this request requires acknowledgment.

getLocale

public java.util.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.


getLocales

public java.util.List<java.util.Locale> 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.


getParameter

public java.lang.String getParameter(java.lang.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.

Parameters:
name - Name of the desired request parameter

getParameterMap

public java.util.Map<java.lang.String,java.lang.String[]> 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.

Returns:
A Map containing parameter names as keys and parameter values as map values.

getParameterNames

public java.util.Set<java.lang.String> getParameterNames()
Return the names of all defined request parameters for this request.


getParameterValues

public java.lang.String[] getParameterValues(java.lang.String name)
Return the defined values for the specified request parameter, if any; otherwise, return null.

Parameters:
name - Name of the desired request parameter

getProtocol

public Protocol getProtocol()
Return the protocol and version used to make this Request.


getReader

public NIOReader getReader()

Returns the NIOReader associated with this Request. This NIOReader will not block while reading content.

Returns:
the NIOReader associated with this Request.
Throws:
java.lang.IllegalStateException - if getInputStream(boolean) or getInputStream() has already been called for this request.
Since:
2.1.2

getReader

public NIOReader getReader(boolean blocking)

Returns the NIOReader associated with this Request.

Parameters:
blocking - if true, the NIOReader will only be usable in blocking mode.
Throws:
java.lang.IllegalStateException - if getInputStream(boolean) or getInputStream() has already been called for this request.

getRemoteAddr

public java.lang.String getRemoteAddr()
Return the remote IP address making this Request.


getRemoteHost

public java.lang.String getRemoteHost()
Return the remote host name making this Request.


getRemotePort

public int getRemotePort()
Returns the Internet Protocol (IP) source port of the client or last proxy that sent the request.


getLocalName

public java.lang.String getLocalName()
Returns the host name of the Internet Protocol (IP) interface on which the request was received.


getLocalAddr

public java.lang.String getLocalAddr()
Returns the Internet Protocol (IP) address of the interface on which the request was received.


getLocalPort

public int getLocalPort()
Returns the Internet Protocol (IP) port number of the interface on which the request was received.


getScheme

public java.lang.String getScheme()
Return the scheme used to make this Request.


getServerName

public java.lang.String getServerName()
Return the server name responding to this Request.


getServerPort

public int getServerPort()
Return the server port responding to this Request.


isSecure

public boolean isSecure()
Was this request received on a secure connection?


removeAttribute

public void removeAttribute(java.lang.String name)
Remove the specified request attribute if it exists.

Parameters:
name - Name of the request attribute to remove

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value)
Set the specified request attribute to the specified value.

Parameters:
name - Name of the request attribute to set
value - The associated value

setCharacterEncoding

public void setCharacterEncoding(java.lang.String encoding)
                          throws java.io.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(). Otherwise, it has no effect.

Parameters:
encoding - String containing the name of the character encoding.
Throws:
java.io.UnsupportedEncodingException - if this ServletRequest is still in a state where a character encoding may be set, but the specified encoding is invalid
Since:
Servlet 2.3

setMaxDispatchDepth

public static void setMaxDispatchDepth(int depth)
Static setter method for the maximum dispatch depth


getMaxDispatchDepth

public static int getMaxDispatchDepth()

incrementDispatchDepth

public int incrementDispatchDepth()
Increment the depth of application dispatch


decrementDispatchDepth

public int decrementDispatchDepth()
Decrement the depth of application dispatch


isMaxDispatchDepthReached

public boolean isMaxDispatchDepthReached()
Check if the application dispatching has reached the maximum


addCookie

public void addCookie(Cookie cookie)
Add a Cookie to the set of Cookies associated with this Request.

Parameters:
cookie - The new cookie

addLocale

public void addLocale(java.util.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().

Parameters:
locale - The new preferred Locale

addParameter

public void addParameter(java.lang.String name,
                         java.lang.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).

Parameters:
name - Name of this request parameter
values - Corresponding values for this request parameter

clearCookies

public void clearCookies()
Clear the collection of Cookies associated with this Request.


clearHeaders

public void clearHeaders()
Clear the collection of Headers associated with this Request.


clearLocales

public void clearLocales()
Clear the collection of Locales associated with this Request.


clearParameters

public void clearParameters()
Clear the collection of parameters associated with this Request.


getDecodedRequestURI

public java.lang.String getDecodedRequestURI()
                                      throws java.io.CharConversionException
Get the decoded request URI.

Returns:
the URL decoded request URI
Throws:
java.io.CharConversionException

setUserPrincipal

public void setUserPrincipal(java.security.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.

Parameters:
principal - The user Principal

getAuthType

public java.lang.String getAuthType()
Return the authentication type used for this Request.


getCookies

public Cookie[] getCookies()
Return the set of Cookies received with this Request.


setCookies

public void setCookies(Cookie[] cookies)
Set the set of cookies received with this Request.


getDateHeader

public long getDateHeader(java.lang.String name)
Return the value of the specified date header, if any; otherwise return -1.

Parameters:
name - Name of the requested date header
Throws:
java.lang.IllegalArgumentException - if the specified header value cannot be converted to a date

getDateHeader

public long getDateHeader(Header header)
Return the value of the specified date header, if any; otherwise return -1.

Parameters:
header - the requested date Header
Throws:
java.lang.IllegalArgumentException - if the specified header value cannot be converted to a date
Since:
2.1.2

getHeader

public java.lang.String getHeader(java.lang.String name)
Return the first value of the specified header, if any; otherwise, return null

Parameters:
name - Name of the requested header

getHeader

public java.lang.String getHeader(Header header)
Return the first value of the specified header, if any; otherwise, return null

Parameters:
header - the requested Header
Since:
2.1.2

getHeaders

public java.lang.Iterable<java.lang.String> getHeaders(java.lang.String name)
Return all of the values of the specified header, if any; otherwise, return an empty enumeration.

Parameters:
name - Name of the requested header

getHeaders

public java.lang.Iterable<java.lang.String> getHeaders(Header header)
Return all of the values of the specified header, if any; otherwise, return an empty enumeration.

Parameters:
header - the requested Header
Since:
2.1.2

getHeaderNames

public java.lang.Iterable<java.lang.String> getHeaderNames()
Return the names of all headers received with this request.


getIntHeader

public int getIntHeader(java.lang.String name)
Return the value of the specified header as an integer, or -1 if there is no such header for this request.

Parameters:
name - Name of the requested header
Throws:
java.lang.IllegalArgumentException - if the specified header value cannot be converted to an integer

getIntHeader

public int getIntHeader(Header header)
Return the value of the specified header as an integer, or -1 if there is no such header for this request.

Parameters:
header - the requested Header
Throws:
java.lang.IllegalArgumentException - if the specified header value cannot be converted to an integer
Since:
2.1.2

getMethod

public Method getMethod()
Return the HTTP request method used in this Request.


setMethod

public void setMethod(java.lang.String method)
Sets the HTTP request method used in this Request.

Parameters:
method - the HTTP request method used in this Request.

getQueryString

public java.lang.String getQueryString()
Return the query string associated with this request.


setQueryString

public void setQueryString(java.lang.String queryString)
Sets the query string associated with this request.

Parameters:
queryString - the query string associated with this request.

getRemoteUser

public java.lang.String getRemoteUser()
Return the name of the remote user that has been authenticated for this Request.


getRequestedSessionId

public java.lang.String getRequestedSessionId()
Return the session identifier included in this request, if any.


getRequestURI

public java.lang.String getRequestURI()
Return the request URI for this request.


setRequestURI

public void setRequestURI(java.lang.String uri)
Sets the request URI for this request.

Parameters:
uri - the request URI for this request.

getRequestURL

public java.lang.StringBuilder 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 StringBuilder, 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.

Returns:
A StringBuffer object containing the reconstructed URL

appendRequestURL

public static java.lang.StringBuilder appendRequestURL(Request request,
                                                       java.lang.StringBuilder buffer)
Appends the reconstructed URL the client used to make the request. The appended URL contains a protocol, server name, port number, and server path, but it does not include query string parameters.

Because this method returns a StringBuilder, 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.

Returns:
A StringBuilder object containing the appended reconstructed URL

appendRequestURL

public static java.lang.StringBuffer appendRequestURL(Request request,
                                                      java.lang.StringBuffer buffer)
Appends the reconstructed URL the client used to make the request. The appended 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.

Returns:
A StringBuffer object containing the appended reconstructed URL

getUserPrincipal

public java.security.Principal getUserPrincipal()
Return the principal that has been authenticated for this Request.


getContext

public FilterChainContext getContext()

unescape

protected java.lang.String unescape(java.lang.String s)

parseCookies

protected void parseCookies()
Parse cookies.


getInputBuffer

public InputBuffer getInputBuffer()
Returns:
the InputBuffer associated with this request, which is the source for getInputStream(boolean) and getReader(boolean).

getRawCookies

protected Cookies getRawCookies()
TODO DOCS


parseRequestParameters

protected void parseRequestParameters()
Parse request parameters.


getPostBody

public Buffer getPostBody(int len)
                   throws java.io.IOException
Gets the POST body of this request.

Returns:
The POST body of this request
Throws:
java.io.IOException

skipPostBody

protected void skipPostBody(int len)
                     throws java.io.IOException
Skips the POST body of this request.

Parameters:
len - how much of the POST body to skip.
Throws:
java.io.IOException

parseLocales

protected void parseLocales()
Parse request locales.


parseLocalesHeader

protected void parseLocalesHeader(java.lang.String value)
Parse accept-language header value.


getJrouteId

public java.lang.String getJrouteId()
Gets the jroute id of this request, which may have been sent as a separate JROUTE cookie or appended to the session identifier encoded in the URI (if cookies have been disabled).

Returns:
The jroute id of this request, or null if this request does not carry any jroute id

getSession

public Session getSession()
Return the session associated with this Request, creating one if necessary.


getSession

public Session getSession(boolean create)
Return the session associated with this Request, creating one if necessary and requested.

Parameters:
create - Create a new session if one does not exist

doGetSession

protected Session doGetSession(boolean create)

isRequestedSessionIdFromCookie

public boolean isRequestedSessionIdFromCookie()
Return true if the session identifier included in this request came from a cookie.


isRequestedSessionIdFromURL

public boolean isRequestedSessionIdFromURL()
Return true if the session identifier included in this request came from the request URI.


isRequestedSessionIdValid

public boolean isRequestedSessionIdValid()
Return true if the session identifier included in this request identifies a valid session.


configureSessionCookie

protected void configureSessionCookie(Cookie cookie)
Configures the given JSESSIONID cookie.

Parameters:
cookie - The JSESSIONID cookie to be configured

parseSessionId

protected void parseSessionId()
Parse session id in URL.


setRequestedSessionCookie

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.

Parameters:
flag - The new flag

setRequestedSessionId

public void setRequestedSessionId(java.lang.String id)
Set the requested session ID for this request. This is normally called by the HTTP Connector, when it parses the request headers.

Parameters:
id - The new session id

setRequestedSessionURL

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.

Parameters:
flag - The new flag

initiateAsyncronousDataReceiving

public void initiateAsyncronousDataReceiving()
Initiates asynchronous data receiving. This is service method, usually users don't have to call it explicitly.



Copyright © 2011 Oracle Corpration. All Rights Reserved.