|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.glassfish.grizzly.http.server.Request
public class Request
Wrapper object for the Coyote request.
| Field Summary | |
|---|---|
protected HashMap<String,Object> |
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 FilterChainContext |
ctx
|
protected static Locale |
defaultLocale
The default Locale if none are specified. |
protected Object |
dispatcherType
The current dispatcher type. |
protected SimpleDateFormat[] |
formats
|
protected HttpServerFilter |
httpServerFilter
|
protected HttpContent |
initialRequestContent
|
protected InputBuffer |
inputBuffer
The associated input buffer. |
protected NIOInputStream |
inputStream
NIOInputStream. |
protected String |
localAddr
Local address |
protected ArrayList<Locale> |
locales
The preferred Locales associated 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 Parameters |
parameters
|
protected byte[] |
postData
|
protected Cookies |
rawCookies
|
protected NIOReader |
reader
Reader. |
protected String |
remoteAddr
Remote address. |
protected String |
remoteHost
Remote host. |
protected int |
remotePort
Remote port |
protected HttpRequestPacket |
request
HTTP Request Packet |
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 Response |
response
The response with which this request is associated. |
protected boolean |
secure
Secure flag. |
protected boolean |
sessionParsed
Session parsed flag. |
protected static StringManager |
sm
The string manager for this package. |
protected Subject |
subject
The Subject associated with the current AccessControllerContext |
protected Principal |
userPrincipal
User principal. |
protected boolean |
usingInputStream
Using stream flag. |
protected boolean |
usingReader
Using writer flag. |
| Constructor Summary | |
|---|---|
protected |
Request()
|
| Method Summary | |
|---|---|
void |
addCookie(Cookie cookie)
Add a Cookie to the set of Cookies 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. |
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. |
int |
decrementDispatchDepth()
Decrement the depth of application dispatch |
protected Session |
doGetSession(boolean create)
|
Object |
getAttribute(String name)
Return the specified request attribute if it exists; otherwise, return null. |
Enumeration<String> |
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. |
FilterChainContext |
getContext()
|
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. |
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. |
HttpContent |
getInitialRequestContent()
|
protected InputBuffer |
getInputBuffer()
|
NIOInputStream |
getInputStream(boolean blocking)
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<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. |
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<String,String[]> |
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. |
Protocol |
getProtocol()
Return the protocol and version used to make this Request. |
String |
getQueryString()
Return the query string associated with this request. |
protected Cookies |
getRawCookies()
TODO DOCS |
NIOReader |
getReader(boolean blocking)
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. |
HttpRequestPacket |
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. |
StringBuilder |
getRequestURL()
Reconstructs the URL the client used to make the request. |
Response |
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. |
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. |
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,
HttpContent initialRequestContent,
FilterChainContext ctx,
HttpServerFilter httpServerFilter)
|
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 |
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. |
protected 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. |
boolean |
requiresAcknowledgement()
|
void |
setAttribute(String name,
Object value)
Set the specified request attribute to the specified value. |
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 |
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 |
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 |
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 |
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 |
setUserPrincipal(Principal principal)
Set the Principal who has been authenticated for this Request. |
protected String |
unescape(String s)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected HttpRequestPacket request
protected HttpContent initialRequestContent
protected FilterChainContext ctx
protected HttpServerFilter httpServerFilter
protected static final StringManager sm
protected Cookie[] cookies
protected Cookies rawCookies
protected SimpleDateFormat[] formats
protected static final Locale defaultLocale
protected HashMap<String,Object> attributes
protected ArrayList<Locale> locales
protected String authType
protected Object dispatcherType
protected InputBuffer inputBuffer
protected NIOInputStream inputStream
protected NIOReader reader
protected boolean usingInputStream
protected boolean usingReader
protected Principal userPrincipal
protected boolean sessionParsed
protected boolean requestParametersParsed
protected boolean cookiesParsed
protected boolean secure
protected Subject subject
protected static final int CACHED_POST_LEN
protected byte[] postData
protected ParameterMap parameterMap
protected Parameters parameters
protected Object requestDispatcherPath
protected boolean requestedSessionCookie
protected String requestedSessionId
protected boolean requestedSessionURL
protected boolean localesParsed
protected int localPort
protected String remoteAddr
protected String remoteHost
protected int remotePort
protected String localName
protected String localAddr
protected Response response
| Constructor Detail |
|---|
protected Request()
| Method Detail |
|---|
public static Request create()
public void initialize(Response response,
HttpRequestPacket request,
HttpContent initialRequestContent,
FilterChainContext ctx,
HttpServerFilter httpServerFilter)
public HttpRequestPacket getRequest()
public HttpContent getInitialRequestContent()
public Response getResponse()
protected final void recycle()
public String getAuthorization()
public NIOInputStream createInputStream()
throws IOException
IOException - if an input/output error occurspublic Object getNote(String name)
null if no such binding exists.
name - Name of the note to be returnedpublic Iterator getNoteNames()
public void removeNote(String name)
name - Name of the note to be removed
public void setNote(String name,
Object value)
name - Name to which the object should be boundvalue - Object to be bound to the specified namepublic void setServerName(String name)
name - The server namepublic void setServerPort(int port)
port - The server portpublic Object getAttribute(String name)
null.
name - Name of the request attribute to returnpublic Enumeration<String> getAttributeNames()
Enumeration if there are none.
public String getCharacterEncoding()
public int getContentLength()
public String getContentType()
public NIOInputStream getInputStream(boolean blocking)
throws IOException
createInputStream().
blocking - if true, the NIOInputStream
will only be usable in blocking mode.
IllegalStateException - if getReader(boolean) has
already been called for this request
IOException - if an input/output error occurspublic boolean asyncInput()
true if getInputStream(boolean) or
getReader(boolean) were invoked with an argument value of
truepublic boolean requiresAcknowledgement()
true if this request requires acknowledgement.public Locale getLocale()
Accept-Language header
that was encountered. If the request did not specify a preferred
language, the server's default Locale is returned.
public Enumeration<Locale> getLocales()
Accept-Language
headers that were encountered. If the request did not specify a
preferred language, the server's default Locale is returned.
public String getParameter(String name)
null. If there is more than one value defined,
return only the first one.
name - Name of the desired request parameterpublic Map<String,String[]> getParameterMap()
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.
Map containing parameter names as keys
and parameter values as map values.public Enumeration getParameterNames()
public String[] getParameterValues(String name)
null.
name - Name of the desired request parameterpublic Protocol getProtocol()
public NIOReader getReader(boolean blocking)
throws IOException
BufferedReader around the
servlet input stream returned by createInputStream().
blocking - if true, the NIOInputStream
will only be usable in blocking mode.
IllegalStateException - if getInputStream(boolean)
has already been called for this request
IOException - if an input/output error occurspublic String getRemoteAddr()
public String getRemoteHost()
public int getRemotePort()
public String getLocalName()
public String getLocalAddr()
public int getLocalPort()
public String getScheme()
public String getServerName()
public int getServerPort()
public boolean isSecure()
public boolean isRequestedSessionIdValid()
public boolean isRequestedSessionIdFromCookie()
public boolean isRequestedSessionIdFromURL()
public void removeAttribute(String name)
name - Name of the request attribute to remove
public void setAttribute(String name,
Object value)
name - Name of the request attribute to setvalue - The associated value
public void setCharacterEncoding(String enc)
throws UnsupportedEncodingException
getReader(). Otherwise, it has no
effect.
enc - String containing the name of
the character encoding.
UnsupportedEncodingException - if this
ServletRequest is still in a state where a
character encoding may be set, but the specified
encoding is invalidpublic static void setMaxDispatchDepth(int depth)
public static int getMaxDispatchDepth()
public int incrementDispatchDepth()
public int decrementDispatchDepth()
public boolean isMaxDispatchDepthReached()
public void addCookie(Cookie cookie)
cookie - The new cookiepublic void addLocale(Locale locale)
locale - The new preferred Locale
public void addParameter(String name,
String[] values)
name - Name of this request parametervalues - Corresponding values for this request parameterpublic void clearCookies()
public void clearHeaders()
public void clearLocales()
public void clearParameters()
public void setAuthType(String type)
null. Typical values are "BASIC",
"DIGEST", or "SSL".
type - The authentication type used
public String getDecodedRequestURI()
throws CharConversionException
CharConversionExceptionpublic void setUserPrincipal(Principal principal)
getRemoteUser() method.
principal - The user Principalpublic String getAuthType()
public Cookie[] getCookies()
public void setCookies(Cookie[] cookies)
public long getDateHeader(String name)
name - Name of the requested date header
IllegalArgumentException - if the specified header value
cannot be converted to a datepublic String getHeader(String name)
null
name - Name of the requested headerpublic Enumeration getHeaders(String name)
name - Name of the requested headerpublic Enumeration getHeaderNames()
public int getIntHeader(String name)
name - Name of the requested header
IllegalArgumentException - if the specified header value
cannot be converted to an integerpublic String getMethod()
public String getQueryString()
public String getRemoteUser()
public String getRequestedSessionId()
public String getRequestURI()
public StringBuilder getRequestURL()
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.
StringBuffer object containing the
reconstructed URLpublic Principal getUserPrincipal()
public FilterChainContext getContext()
protected String unescape(String s)
protected void parseCookies()
protected InputBuffer getInputBuffer()
InputBuffer associated with this request.protected Cookies getRawCookies()
protected void parseRequestParameters()
protected byte[] getPostBody()
throws IOException
IOException
protected int readPostBody(byte[] body,
int len)
throws IOException
IOExceptionprotected void parseLocales()
protected void parseLocalesHeader(String value)
public String getJrouteId()
JROUTE cookie or appended to the
session identifier encoded in the URI (if cookies have been disabled).
public Session getSession()
public Session getSession(boolean create)
create - Create a new session if one does not existprotected Session doGetSession(boolean create)
protected void configureSessionCookie(Cookie cookie)
cookie - The JSESSIONID cookie to be configuredprotected void parseSessionId()
protected void parseSessionIdFromRequestURI()
public void setRequestedSessionCookie(boolean flag)
flag - The new flagpublic void setRequestedSessionId(String id)
id - The new session idpublic void setRequestedSessionURL(boolean flag)
flag - The new flag
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||