|
||||||||||
| 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.
| Nested Class Summary | |
|---|---|
static class |
Request.Note<E>
|
| Field Summary | |
|---|---|
protected java.util.List<AfterServiceListener> |
afterServicesList
|
protected java.util.HashMap<java.lang.String,java.lang.Object> |
attributes
The attributes associated with this Request, keyed by attribute name. |
protected java.lang.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 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 NIOInputStream |
inputStream
NIOInputStream. |
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 NIOReader |
reader
Reader. |
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 static StringManager |
sm
The string manager for this package. |
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
|
createNote(java.lang.String name)
Create a named Request.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. |
|
static Connection |
getConnection()
|
|
int |
getContentLength()
Return the content length for this Request. |
|
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(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(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(java.lang.String name)
Return all of the values of the specified header, if any; otherwise, return an empty enumeration. |
|
protected InputBuffer |
getInputBuffer()
|
|
NIOInputStream |
getInputStream(boolean blocking)
Return the servlet input stream 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. |
|
|
getNote(Request.Note<E> note)
Return the Request.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(boolean blocking)
Read the Reader wrapping the input stream for 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)
|
|
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. |
|
void |
populateCertificateAttribute()
|
|
void |
populateSSLAttributes()
|
|
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. |
|
|
removeNote(Request.Note<E> note)
Remove the Request.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 |
setAuthType(java.lang.String type)
Set the authentication type used for this request, if any; otherwise set the type to null. |
|
void |
setCharacterEncoding(java.lang.String encoding)
Overrides the name of the character encoding used in the body of this request. |
|
static void |
setConnection(Connection conn)
|
|
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. |
|
|
setNote(Request.Note<E> note,
E value)
Bind the Request.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 |
|---|
protected HttpRequestPacket request
protected FilterChainContext ctx
protected HttpServerFilter httpServerFilter
protected final java.util.List<AfterServiceListener> afterServicesList
protected static final StringManager sm
protected Cookie[] cookies
protected Cookies rawCookies
protected static final java.util.Locale defaultLocale
protected final java.util.HashMap<java.lang.String,java.lang.Object> attributes
protected final java.util.ArrayList<java.util.Locale> locales
protected java.lang.String authType
protected java.lang.Object dispatcherType
protected InputBuffer inputBuffer
protected NIOInputStream inputStream
protected NIOReader reader
protected boolean usingInputStream
protected boolean usingReader
protected java.security.Principal userPrincipal
protected boolean sessionParsed
protected boolean requestParametersParsed
protected boolean cookiesParsed
protected boolean secure
protected javax.security.auth.Subject subject
protected static final int CACHED_POST_LEN
protected byte[] postData
protected final ParameterMap parameterMap
protected final Parameters parameters
protected java.lang.Object requestDispatcherPath
protected boolean requestedSessionCookie
protected java.lang.String requestedSessionId
protected boolean requestedSessionURL
protected boolean localesParsed
protected Response response
| Constructor Detail |
|---|
protected Request()
| Method Detail |
|---|
public static Request create()
public static Connection getConnection()
public static void setConnection(Connection conn)
public void initialize(Response response,
HttpRequestPacket request,
FilterChainContext ctx,
HttpServerFilter httpServerFilter)
public HttpRequestPacket getRequest()
public Response getResponse()
public void addAfterServiceListener(AfterServiceListener listener)
listener - the listener, which will be notified, once Request processing will be finished.public void removeAfterServiceListener(AfterServiceListener listener)
addAfterServiceListener(org.glassfish.grizzly.http.server.AfterServiceListener).
listener - the "after-service" listener, which was previously added by addAfterServiceListener(org.glassfish.grizzly.http.server.AfterServiceListener).protected void onAfterService()
protected final void recycle()
public java.lang.String getAuthorization()
public NIOInputStream createInputStream()
java.io.IOException - if an input/output error occurspublic static <E> Request.Note<E> createNote(java.lang.String name)
Request.Note associated with this Request.
E - the Request.Note type.name - the Request.Note name.
Request.Note.public <E> E getNote(Request.Note<E> note)
Request.Note value associated with this Request,
or null if no such binding exists.
Use createNote(java.lang.String) to create a new Request.Note.
note - Request.Note value to be returnedpublic java.util.Set<java.lang.String> getNoteNames()
Set containing the String names of all note bindings
that exist for this request.
Use createNote(java.lang.String) to create a new Request.Note.
Set containing the String names of all note bindings
that exist for this request.public <E> E removeNote(Request.Note<E> note)
Request.Note value associated with this request.
Use createNote(java.lang.String) to create a new Request.Note.
note - Request.Note value to be removed
public <E> void setNote(Request.Note<E> note,
E value)
Request.Note value to this Request,
replacing any existing binding for this name.
Use createNote(java.lang.String) to create a new Request.Note.
note - Request.Note to which the object should be boundvalue - the Request.Note value be bound to the specified Request.Note.public void setServerName(java.lang.String name)
name - The server namepublic void setServerPort(int port)
port - The server portpublic java.lang.String getContextPath()
HttpHandlers in the default (root) context, this method returns "".
The container does not decode this string.
protected void setContextPath(java.lang.String contextPath)
public java.lang.Object getAttribute(java.lang.String name)
null.
name - Name of the request attribute to returnpublic java.util.Set<java.lang.String> getAttributeNames()
Set if there are none.
public java.lang.String getCharacterEncoding()
public int getContentLength()
public java.lang.String getContentType()
public NIOInputStream getInputStream(boolean blocking)
createInputStream().
blocking - if true, the NIOInputStream
will only be usable in blocking mode.
java.lang.IllegalStateException - if getReader(boolean) has
already been called for this requestpublic 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 java.util.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 java.util.List<java.util.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 java.lang.String getParameter(java.lang.String name)
null. If there is more than one value defined,
return only the first one.
name - Name of the desired request parameterpublic java.util.Map<java.lang.String,java.lang.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 java.util.Set<java.lang.String> getParameterNames()
public java.lang.String[] getParameterValues(java.lang.String name)
null.
name - Name of the desired request parameterpublic Protocol getProtocol()
public NIOReader getReader(boolean blocking)
BufferedReader around the
servlet input stream returned by createInputStream().
blocking - if true, the NIOInputStream
will only be usable in blocking mode.
java.lang.IllegalStateException - if getInputStream(boolean)
has already been called for this requestpublic java.lang.String getRemoteAddr()
public java.lang.String getRemoteHost()
public int getRemotePort()
public java.lang.String getLocalName()
public java.lang.String getLocalAddr()
public int getLocalPort()
public java.lang.String getScheme()
public java.lang.String getServerName()
public int getServerPort()
public boolean isSecure()
public void removeAttribute(java.lang.String name)
name - Name of the request attribute to remove
public void setAttribute(java.lang.String name,
java.lang.Object value)
name - Name of the request attribute to setvalue - The associated value
public void setCharacterEncoding(java.lang.String encoding)
throws java.io.UnsupportedEncodingException
getReader(). Otherwise, it has no
effect.
encoding - String containing the name of
the character encoding.
java.io.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(java.util.Locale locale)
locale - The new preferred Locale
public void addParameter(java.lang.String name,
java.lang.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(java.lang.String type)
null. Typical values are "BASIC",
"DIGEST", or "SSL".
type - The authentication type used
public java.lang.String getDecodedRequestURI()
throws java.io.CharConversionException
java.io.CharConversionExceptionpublic void setUserPrincipal(java.security.Principal principal)
getRemoteUser() method.
principal - The user Principalpublic java.lang.String getAuthType()
public Cookie[] getCookies()
public void setCookies(Cookie[] cookies)
public long getDateHeader(java.lang.String name)
name - Name of the requested date header
java.lang.IllegalArgumentException - if the specified header value
cannot be converted to a datepublic java.lang.String getHeader(java.lang.String name)
null
name - Name of the requested headerpublic java.lang.Iterable<java.lang.String> getHeaders(java.lang.String name)
name - Name of the requested headerpublic java.lang.Iterable<java.lang.String> getHeaderNames()
public int getIntHeader(java.lang.String name)
name - Name of the requested header
java.lang.IllegalArgumentException - if the specified header value
cannot be converted to an integerpublic Method getMethod()
public void setMethod(java.lang.String method)
method - the HTTP request method used in this Request.public java.lang.String getQueryString()
public void setQueryString(java.lang.String queryString)
queryString - the query string associated with this request.public java.lang.String getRemoteUser()
public java.lang.String getRequestedSessionId()
public java.lang.String getRequestURI()
public void setRequestURI(java.lang.String uri)
uri - the request URI for this request.public java.lang.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 URL
public static java.lang.StringBuilder appendRequestURL(Request request,
java.lang.StringBuilder buffer)
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.
StringBuilder object containing the appended
reconstructed URL
public static java.lang.StringBuffer appendRequestURL(Request request,
java.lang.StringBuffer buffer)
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.
StringBuffer object containing the appended
reconstructed URLpublic java.security.Principal getUserPrincipal()
public FilterChainContext getContext()
public void populateCertificateAttribute()
public void populateSSLAttributes()
protected java.lang.String unescape(java.lang.String s)
protected void parseCookies()
protected InputBuffer getInputBuffer()
InputBuffer associated with this request.protected Cookies getRawCookies()
protected void parseRequestParameters()
public Buffer getPostBody(int len)
throws java.io.IOException
java.io.IOException
protected void skipPostBody(int len)
throws java.io.IOException
len - how much of the POST body to skip.
java.io.IOExceptionprotected void parseLocales()
protected void parseLocalesHeader(java.lang.String value)
public java.lang.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)
public boolean isRequestedSessionIdFromCookie()
true if the session identifier included in this
request came from a cookie.
public boolean isRequestedSessionIdFromURL()
true if the session identifier included in this
request came from the request URI.
public boolean isRequestedSessionIdValid()
protected void configureSessionCookie(Cookie cookie)
cookie - The JSESSIONID cookie to be configuredprotected void parseSessionId()
public void setRequestedSessionCookie(boolean flag)
flag - The new flagpublic void setRequestedSessionId(java.lang.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 | |||||||||