com.sun.grizzly.tcp.http11
Class GrizzlyRequest

java.lang.Object
  extended by com.sun.grizzly.tcp.http11.GrizzlyRequest
Direct Known Subclasses:
GrizzletRequest

public class GrizzlyRequest
extends 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  HashMap attributes
          The attributes associated with this Request, keyed by attribute name.
protected  String authType
          Authentication type.
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 static Locale defaultLocale
          The default Locale if none are specified.
protected  Object dispatcherType
          The current dispatcher type.
protected  SimpleDateFormat[] formats
           
protected  GrizzlyInputBuffer inputBuffer
          The associated input buffer.
protected  GrizzlyInputStream inputStream
          GrizzlyInputStream.
protected  String localAddr
          Local address
protected  ArrayList locales
          The preferred Locales assocaited with this Request.
protected  boolean localesParsed
          Parse locales.
protected  String localName
          Local address
protected  int localPort
          Local port
protected  ParameterMap parameterMap
          Hash map used in the getParametersMap method.
protected  byte[] postData
           
protected  GrizzlyReader reader
          Reader.
protected  String remoteAddr
          Remote address.
protected  String remoteHost
          Remote host.
protected  int remotePort
          Remote port
protected  Request request
          Grizzly request.
protected  Object requestDispatcherPath
          The current request dispatcher path.
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  boolean requestParametersParsed
          Request parameters parsed flag.
protected  GrizzlyResponse response
          The response with which this request is associated.
protected  boolean secure
          Secure flag.
protected  boolean sessionParsed
          GrizzlySession parsed flag.
protected static StringManager sm
          The string manager for this package.
protected  Socket socket
          The socket through which this Request was received.
protected  Subject subject
          The Subject associated with the current AccessControllerContext
protected  B2CConverter URIConverter
          URI byte to char converter (not recycled).
protected  Principal userPrincipal
          User principal.
protected  boolean usingInputStream
          Using stream flag.
protected  boolean usingReader
          Using writer flag.
 
Constructor Summary
GrizzlyRequest()
           
 
Method Summary
 void addCookie(Cookie cookie)
          Add a Cookie to the set of Cookies associated with this Request.
 void addHeader(String name, String value)
          Add a Header to the set of Headers associated with this Request.
 void addLocale(Locale locale)
          Add a Locale to the set of preferred Locales for this Request.
 void addParameter(String name, String[] values)
          Add a parameter name and corresponding set of values to this Request.
 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.
 GrizzlyInputStream createInputStream()
          Create and return a GrizzlyInputStream to read the content associated with this Request.
 int decrementDispatchDepth()
          Decrement the depth of application dispatch
protected  GrizzlySession doGetSession(boolean create)
           
 void finishRequest()
          Perform whatever actions are required to flush and close the input stream or reader, in a single operation.
 Object getAttribute(String name)
          Return the specified request attribute if it exists; otherwise, return null.
 Enumeration getAttributeNames()
          Return the names of all request attributes for this Request, or an empty Enumeration if there are none.
 String getAuthorization()
          Return the authorization credentials sent with this request.
 String getAuthType()
          Return the authentication type used for this Request.
 String getCharacterEncoding()
          Return the character encoding for this Request.
 int getContentLength()
          Return the content length for this Request.
 String getContentType()
          Return the content type for this Request.
 Cookie[] getCookies()
          Return the set of Cookies received with this Request.
 long getDateHeader(String name)
          Return the value of the specified date header, if any; otherwise return -1.
 String getDecodedRequestURI()
          Get the decoded request URI.
 MessageBytes getDecodedRequestURIMB()
          Get the decoded request URI.
 String getHeader(String name)
          Return the first value of the specified header, if any; otherwise, return null
 Enumeration getHeaderNames()
          Return the names of all headers received with this request.
 Enumeration getHeaders(String name)
          Return all of the values of the specified header, if any; otherwise, return an empty enumeration.
 GrizzlyInputStream getInputStream()
          Return the servlet input stream for this Request.
 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.
 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).
 String getLocalAddr()
          Returns the Internet Protocol (IP) address of the interface on which the request was received.
 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.
 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.
 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()
           
 String getMethod()
          Return the HTTP request method used in this Request.
 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.
 Iterator getNoteNames()
          Return an Iterator containing the String names of all notes bindings that exist for this request.
 String getParameter(String name)
          Return the value of the specified request parameter, if any; otherwise, return null.
 Map getParameterMap()
          Returns a Map of the parameters of this request.
 Enumeration getParameterNames()
          Return the names of all defined request parameters for this request.
 String[] getParameterValues(String name)
          Return the defined values for the specified request parameter, if any; otherwise, return null.
protected  byte[] getPostBody()
          Gets the POST body of this request.
 String getProtocol()
          Return the protocol and version used to make this Request.
 String getQueryString()
          Return the query string associated with this request.
 BufferedReader getReader()
          Read the Reader wrapping the input stream for this Request.
 String getRemoteAddr()
          Return the remote IP address making this Request.
 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.
 String getRemoteUser()
          Return the name of the remote user that has been authenticated for this Request.
 Request getRequest()
          Get the Coyote request.
 String getRequestedSessionId()
          Return the session identifier included in this request, if any.
 String getRequestURI()
          Return the request URI for this request.
 StringBuffer getRequestURL()
          Reconstructs the URL the client used to make the request.
 GrizzlyResponse getResponse()
          Return the Response with which this Request is associated.
 String getScheme()
          Return the scheme used to make this Request.
 String getServerName()
          Return the server name responding to this Request.
 int getServerPort()
          Return the server port responding to this Request.
 GrizzlySession getSession()
          Return the session associated with this Request, creating one if necessary.
 GrizzlySession getSession(boolean create)
          Return the session associated with this Request, creating one if necessary and requested.
 Socket getSocket()
          Return the Socket (if any) through which this Request was received.
 InputStream getStream()
          Return the input stream associated with this Request.
 B2CConverter getURIConverter()
          Return the URI converter.
 Principal getUserPrincipal()
          Return the principal that has been authenticated for this Request.
 int incrementDispatchDepth()
          Increment the depth of application dispatch
 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 isSecure()
          Was this request received on a secure connection?
protected  Cookie makeCookie(ServerCookie scookie)
           
protected  Cookie makeCookie(ServerCookie scookie, boolean decode)
           
protected  void parseCookies()
          Parse cookies.
protected  void parseLocales()
          Parse request locales.
protected  void parseLocalesHeader(String value)
          Parse accept-language header value.
protected  void parseRequestParameters()
          Parse request parameters.
protected  void parseSessionId()
          Parse session id in URL.
protected  void parseSessionIdFromRequestURI()
          Extracts the session ID from the request URI.
protected  int readPostBody(byte[] body, int len)
          Read post body in an array.
 void recycle()
          Release all object references, and initialize instance variables, in preparation for reuse of this object.
 void removeAttribute(String name)
          Remove the specified request attribute if it exists.
 void removeNote(String name)
          Remove any object bound to the specified name in the internal notes for this request.
 void setAttribute(String name, Object value)
          Set the specified request attribute to the specified value.
 void setAuthorization(String authorization)
          Set the authorization credentials sent with this request.
 void setAuthType(String type)
          Set the authentication type used for this request, if any; otherwise set the type to null.
 void setCharacterEncoding(String enc)
          Overrides the name of the character encoding used in the body of this request.
 void setContentLength(int length)
          Set the content length associated with this Request.
 void setContentType(String type)
          Set the content type (and optionally the character encoding) associated with this Request.
 void setCookies(Cookie[] cookies)
          Set the set of cookies recieved with this Request.
 void setDecodedRequestURI(String uri)
          Set the decoded request URI.
static void setMaxDispatchDepth(int depth)
          Static setter method for the maximum dispatch depth
 void setMethod(String method)
          Set the HTTP request method used for this Request.
 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.
 void setProtocol(String protocol)
          Set the protocol name and version associated with this Request.
 void setQueryString(String query)
          Set the query string for this Request.
 void setRemoteAddr(String remoteAddr)
          Set the IP address of the remote client associated with this Request.
 void setRemoteHost(String remoteHost)
          Set the fully qualified name of the remote client associated with this Request.
 void setRequest(Request request)
          Set the Coyote 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(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(String uri)
          Set the unparsed request URI for this Request.
 void setResponse(GrizzlyResponse response)
          Set the Response with which this Request is associated.
 void setScheme(String scheme)
          Set the name of the scheme associated with this request.
 void setSecure(boolean secure)
          Set the value to be returned by isSecure() for this Request.
 void setServerName(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 setSocket(Socket socket)
          Set the Socket (if any) through which this Request was received.
 void setStream(InputStream stream)
          Set the input stream associated with this Request.
 void setURIConverter(B2CConverter URIConverter)
          Set the URI converter.
 void setUserPrincipal(Principal principal)
          Set the Principal who has been authenticated for this Request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

request

protected Request request
Grizzly request.


sm

protected static StringManager sm
The string manager for this package.


cookies

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


formats

protected SimpleDateFormat[] formats

defaultLocale

protected static Locale defaultLocale
The default Locale if none are specified.


attributes

protected HashMap attributes
The attributes associated with this Request, keyed by attribute name.


locales

protected ArrayList locales
The preferred Locales assocaited with this Request.


authType

protected String authType
Authentication type.


dispatcherType

protected Object dispatcherType
The current dispatcher type.


inputBuffer

protected GrizzlyInputBuffer inputBuffer
The associated input buffer.


inputStream

protected GrizzlyInputStream inputStream
GrizzlyInputStream.


reader

protected GrizzlyReader reader
Reader.


usingInputStream

protected boolean usingInputStream
Using stream flag.


usingReader

protected boolean usingReader
Using writer flag.


userPrincipal

protected Principal userPrincipal
User principal.


sessionParsed

protected boolean sessionParsed
GrizzlySession 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 Subject subject
The Subject associated with the current AccessControllerContext


CACHED_POST_LEN

protected static int CACHED_POST_LEN
Post data buffer.


postData

protected byte[] postData

parameterMap

protected ParameterMap parameterMap
Hash map used in the getParametersMap method.


requestDispatcherPath

protected Object requestDispatcherPath
The current request dispatcher path.


requestedSessionCookie

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


requestedSessionId

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


requestedSessionURL

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


socket

protected Socket socket
The socket through which this Request was received.


localesParsed

protected boolean localesParsed
Parse locales.


localPort

protected int localPort
Local port


remoteAddr

protected String remoteAddr
Remote address.


remoteHost

protected String remoteHost
Remote host.


remotePort

protected int remotePort
Remote port


localName

protected String localName
Local address


localAddr

protected String localAddr
Local address


response

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


URIConverter

protected B2CConverter URIConverter
URI byte to char converter (not recycled).

Constructor Detail

GrizzlyRequest

public GrizzlyRequest()
Method Detail

setRequest

public void setRequest(Request request)
Set the Coyote request.

Parameters:
request - The Grizzly request

getRequest

public Request getRequest()
Get the Coyote request.


getResponse

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


setResponse

public void setResponse(GrizzlyResponse response)
Set the Response with which this Request is associated.

Parameters:
response - The new associated response

recycle

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


getAuthorization

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


setAuthorization

public void setAuthorization(String authorization)
Set the authorization credentials sent with this request.

Parameters:
authorization - The new authorization credentials

getSocket

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.


setSocket

public void setSocket(Socket socket)
Set the Socket (if any) through which this Request was received.

Parameters:
socket - The socket through which this request was received

getStream

public InputStream getStream()
Return the input stream associated with this Request.


setStream

public void setStream(InputStream stream)
Set the input stream associated with this Request.

Parameters:
stream - The new input stream

getURIConverter

public B2CConverter getURIConverter()
Return the URI converter.


setURIConverter

public void setURIConverter(B2CConverter URIConverter)
Set the URI converter.

Parameters:
URIConverter - the new URI connverter

createInputStream

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

Throws:
IOException - if an input/output error occurs

finishRequest

public void finishRequest()
                   throws IOException
Perform whatever actions are required to flush and close the input stream or reader, in a single operation.

Throws:
IOException - if an input/output error occurs

getNote

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.

Parameters:
name - Name of the note to be returned

getNoteNames

public Iterator getNoteNames()
Return an Iterator containing the String names of all notes bindings that exist for this request.


removeNote

public void removeNote(String name)
Remove any object bound to the specified name in the internal notes for this request.

Parameters:
name - Name of the note to be removed

setNote

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.

Parameters:
name - Name to which the object should be bound
value - Object to be bound to the specified name

setContentLength

public void setContentLength(int length)
Set the content length associated with this Request.

Parameters:
length - The new content length

setContentType

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.

Parameters:
type - The new content type

setProtocol

public void setProtocol(String protocol)
Set the protocol name and version associated with this Request.

Parameters:
protocol - Protocol name and version

setRemoteAddr

public void setRemoteAddr(String remoteAddr)
Set the IP address of the remote client associated with this Request.

Parameters:
remoteAddr - The remote IP address

setRemoteHost

public void setRemoteHost(String remoteHost)
Set the fully qualified name of the remote client associated with this Request.

Parameters:
remoteHost - The remote host name

setScheme

public void setScheme(String scheme)
Set the name of the scheme associated with this request. Typical values are http, https, and ftp.

Parameters:
scheme - The scheme

setSecure

public void setSecure(boolean secure)
Set the value to be returned by isSecure() for this Request.

Parameters:
secure - The new isSecure value

setServerName

public void setServerName(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

getAttribute

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

Parameters:
name - Name of the request attribute to return

getAttributeNames

public Enumeration getAttributeNames()
Return the names of all request attributes for this Request, or an empty Enumeration if there are none.


getCharacterEncoding

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


getContentLength

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


getContentType

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


getInputStream

public GrizzlyInputStream getInputStream()
                                  throws IOException
Return the servlet input stream for this Request. The default implementation returns a servlet input stream created by createInputStream().

Throws:
IllegalStateException - if getReader() has already been called for this request
IOException - if an input/output error occurs

getLocale

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.


getLocales

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.


getParameter

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.

Parameters:
name - Name of the desired request parameter

getParameterMap

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.

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

getParameterNames

public Enumeration getParameterNames()
Return the names of all defined request parameters for this request.


getParameterValues

public String[] getParameterValues(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 String getProtocol()
Return the protocol and version used to make this Request.


getReader

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().

Throws:
IllegalStateException - if getInputStream() has already been called for this request
IOException - if an input/output error occurs

getRemoteAddr

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


getRemoteHost

public 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 String getLocalName()
Returns the host name of the Internet Protocol (IP) interface on which the request was received.


getLocalAddr

public 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 String getScheme()
Return the scheme used to make this Request.


getServerName

public 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?


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.


removeAttribute

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

Parameters:
name - Name of the request attribute to remove

setAttribute

public void setAttribute(String name,
                         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(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(). Otherwise, it has no effect.

Parameters:
env - String containing the name of the character encoding.
Throws:
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

addHeader

public void addHeader(String name,
                      String value)
Add a Header to the set of Headers associated with this Request.

Parameters:
name - The new header name
value - The new header value

addLocale

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().

Parameters:
locale - The new preferred Locale

addParameter

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).

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.


setAuthType

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".

Parameters:
type - The authentication type used

setMethod

public void setMethod(String method)
Set the HTTP request method used for this Request.

Parameters:
method - The request method

setQueryString

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.

Parameters:
query - The query string

setRequestURI

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.

Parameters:
uri - The request URI

setDecodedRequestURI

public void setDecodedRequestURI(String uri)
Set the decoded request URI.

Parameters:
uri - The decoded request URI

getDecodedRequestURI

public String getDecodedRequestURI()
Get the decoded request URI.

Returns:
the URL decoded request URI

getDecodedRequestURIMB

public MessageBytes getDecodedRequestURIMB()
Get the decoded request URI.

Returns:
the URL decoded request URI

setUserPrincipal

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.

Parameters:
principal - The user Principal

getAuthType

public 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 recieved with this Request.


getDateHeader

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

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

getHeader

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

Parameters:
name - Name of the requested header

getHeaders

public Enumeration getHeaders(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

getHeaderNames

public Enumeration getHeaderNames()
Return the names of all headers received with this request.


getIntHeader

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.

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

getMethod

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


getQueryString

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


getRemoteUser

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


getRequestedSessionId

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


getRequestURI

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


getRequestURL

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.

Returns:
A StringBuffer object containing the reconstructed URL

getUserPrincipal

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


parseCookies

protected void parseCookies()
Parse cookies.


parseRequestParameters

protected void parseRequestParameters()
Parse request parameters.


getPostBody

protected byte[] getPostBody()
                      throws IOException
Gets the POST body of this request.

Returns:
The POST body of this request
Throws:
IOException

readPostBody

protected int readPostBody(byte[] body,
                           int len)
                    throws IOException
Read post body in an array.

Throws:
IOException

parseLocales

protected void parseLocales()
Parse request locales.


parseLocalesHeader

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


getJrouteId

public 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 GrizzlySession getSession()
Return the session associated with this Request, creating one if necessary.


getSession

public GrizzlySession 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 GrizzlySession doGetSession(boolean create)

configureSessionCookie

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

Parameters:
cookie - The JSESSIONID cookie to be configured

makeCookie

protected Cookie makeCookie(ServerCookie scookie)

makeCookie

protected Cookie makeCookie(ServerCookie scookie,
                            boolean decode)

parseSessionId

protected void parseSessionId()
Parse session id in URL.


parseSessionIdFromRequestURI

protected void parseSessionIdFromRequestURI()
Extracts the session ID from the request URI.


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(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


Copyright © 2010 SUN Microsystems. All Rights Reserved.