- Version:
- $Revision: 1.2 $ $Date: 2007/03/14 02:15:42 $
- Author:
- Remy Maucherat, Craig R. McClanahan
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final List<AfterServiceListener>protected org.glassfish.grizzly.http.Cookie[]The set of cookies associated with this Request.protected booleanCookies parsed flag.protected org.glassfish.grizzly.filterchain.FilterChainContextprotected static final LocaleThe default Locale if none are specified.protected ObjectThe current dispatcher type.protected HttpServerFilterprotected final ServerInputBufferThe associated input buffer.The preferred Locales associated with this Request.protected booleanParse locales.protected final ParameterMapHash map used in the getParametersMap method.protected final org.glassfish.grizzly.http.util.Parametersprotected org.glassfish.grizzly.http.Cookiesprotected org.glassfish.grizzly.http.HttpRequestPacketHTTP Request Packetprotected ObjectThe current request dispatcher path.protected booleanWas the requested session ID received in a cookie?protected StringThe requested session ID (if any) for this request.protected booleanWas the requested session ID received in a URL?protected booleanRequest parameters parsed flag.protected final ResponseThe response with which this request is associated.protected booleanSecure flag.static final StringThe value of this request attribute, as set by the developer must be aFilethat exists, is not a directory, and is readable.static final StringRequest attribute will be associated with a boolean value indicating whether or not it's possible to transfer aFileusing sendfile.static final StringThe value of this request attribute signifies the starting offset of the file transfer.static final StringThe value of this request attribute signifies the total number of bytes to transfer.protected Stringprotected SessionManagerprotected booleanSession parsed flag.protected SubjectThe Subject associated with the current AccessControllerContextTrailer headers, if any.protected PrincipalUser principal.protected booleanUsing stream flag.protected booleanUsing writer flag. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAfterServiceListener(AfterServiceListener listener) Add the listener, which will be notified, once Request processing will be finished.voidaddCookie(org.glassfish.grizzly.http.Cookie cookie) Add a Cookie to the set of Cookies associated with this Request.voidAdd a Locale to the set of preferred Locales for this Request.voidaddParameter(String name, String[] values) Add a parameter name and corresponding set of values to this Request.static StringBufferappendRequestURL(Request request, StringBuffer buffer) Appends the reconstructed URL the client used to make the request.static StringBuilderappendRequestURL(Request request, StringBuilder buffer) Appends the reconstructed URL the client used to make the request.booleanChange the session id of the current session associated with this request and return the new session id.voidClear the collection of Cookies associated with this Request.voidClear the collection of Headers associated with this Request.voidClear the collection of Locales associated with this Request.voidClear the collection of parameters associated with this Request.protected voidconfigureSessionCookie(org.glassfish.grizzly.http.Cookie cookie) Configures the given session cookie.static Requestcreate()org.glassfish.grizzly.http.io.NIOInputStreamCreate and return a NIOInputStream to read the content associated with this Request.static <E> org.glassfish.grizzly.http.Note<E>createNote(String name) Create a namedNoteassociated with this Request.intDecrement the depth of application dispatchprotected SessiondoGetSession(boolean create) getAttribute(String name) Return the specified request attribute if it exists; otherwise, returnnull.Return the names of all request attributes for this Request, or an emptySetif there are none.Return the authentication type used for this Request.Return the character encoding for this Request.org.glassfish.grizzly.Connection<?>intReturn the content length for this Request.longReturn the content length for this Request represented by Java long type.Return the content type for this Request.org.glassfish.grizzly.filterchain.FilterChainContextReturns the portion of the request URI that indicates the context of the request.org.glassfish.grizzly.http.Cookie[]Return the set of Cookies received with this Request.longgetDateHeader(String name) Return the value of the specified date header, if any; otherwise return -1.longgetDateHeader(org.glassfish.grizzly.http.util.Header header) Return the value of the specified date header, if any; otherwise return -1.Get the decoded request URI.Return the first value of the specified header, if any; otherwise, returnnullgetHeader(org.glassfish.grizzly.http.util.Header header) Return the first value of the specified header, if any; otherwise, returnnullReturn the names of all headers received with this request.getHeaders(String name) Return all of the values of the specified header, if any; otherwise, return an empty enumeration.getHeaders(org.glassfish.grizzly.http.util.Header header) Return all of the values of the specified header, if any; otherwise, return an empty enumeration.Returns the part of this request's URL that calls the HttpHandler.org.glassfish.grizzly.http.io.InputBufferReturn theInputStreamfor thisRequest.intgetIntHeader(String name) Return the value of the specified header as an integer, or -1 if there is no such header for this request.intgetIntHeader(org.glassfish.grizzly.http.util.Header header) Return the value of the specified header as an integer, or -1 if there is no such header for this request.Gets the jroute id of this request, which may have been sent as a separateJROUTEcookie or appended to the session identifier encoded in the URI (if cookies have been disabled).Returns the Internet Protocol (IP) address of the interface on which the request was received.Return the preferred Locale that the client will accept content in, based on the value for the firstAccept-Languageheader that was encountered.Return the set of preferred Locales that the client will accept content in, based on the values for anyAccept-Languageheaders that were encountered.Returns the host name of the Internet Protocol (IP) interface on which the request was received.intReturns the Internet Protocol (IP) port number of the interface on which the request was received.static intorg.glassfish.grizzly.http.MethodReturn the HTTP request method used in this Request.org.glassfish.grizzly.http.io.NIOInputStreamReturn theNIOInputStreamfor thisRequest.org.glassfish.grizzly.http.io.NIOReaderReturns theNIOReaderassociated with thisRequest.<E> EgetNote(org.glassfish.grizzly.http.Note<E> note) Return theNotevalue associated with this Request, ornullif no such binding exists.Return aSetcontaining the String names of all note bindings that exist for this request.getParameter(String name) Return the value of the specified request parameter, if any; otherwise, returnnull.Returns aMapof the parameters of this request.Return the names of all defined request parameters for this request.org.glassfish.grizzly.http.util.ParametersReturns the low-level parameters holder for finer control over parameters.String[]getParameterValues(String name) Return the defined values for the specified request parameter, if any; otherwise, returnnull.Returns any extra path information associated with the URL the client sent when it made this request.org.glassfish.grizzly.BuffergetPostBody(int len) Gets the POST body of this request.org.glassfish.grizzly.http.ProtocolReturn the protocol and version used to make this Request.protected org.glassfish.grizzly.http.CookiesTODO DOCSReturn the remote IP address making this Request.Return the remote host name making this Request.intReturns the Internet Protocol (IP) source port of the client or last proxy that sent the request.Return the name of the remote user that has been authenticated for this Request.org.glassfish.grizzly.http.HttpRequestPacketReturn the session identifier included in this request, if any.Return the request URI for this request.Reconstructs the URL the client used to make the request.intReturn the session associated with this Request, creating one if necessary.getSession(boolean create) Return the session associated with this Request, creating one if necessary and requested.protected SessionManagerGet the request trailer headers.Return the principal that has been authenticated for this Request.intIncrement the depth of application dispatchvoidinitialize(org.glassfish.grizzly.http.HttpRequestPacket request, org.glassfish.grizzly.filterchain.FilterChainContext ctx, HttpServerFilter httpServerFilter) booleanCheck if the application dispatching has reached the maximumbooleanbooleanbooleanReturntrueif the session identifier included in this request came from the request URI.booleanbooleanisSecure()final MappingDataprotected Stringprotected voidprotected voidParse cookies.protected voidParse request locales.protected voidparseLocalesHeader(String value) Parse accept-language header value.protected voidParse request parameters.protected voidParse session id in URL.protected voidrecycle()Release all object references, and initialize instance variables, in preparation for reuse of this object.voidRemove the "after-service" listener, which was previously added byaddAfterServiceListener(org.glassfish.grizzly.http.server.AfterServiceListener).voidremoveAttribute(String name) Remove the specified request attribute if it exists.<E> EremoveNote(org.glassfish.grizzly.http.Note<E> note) Remove theNotevalue associated with this request.voidreplayPayload(org.glassfish.grizzly.Buffer buffer) Replays request's payload by setting new payloadBuffer.booleanvoidsetAttribute(String name, Object value) Set the specified request attribute to the specified value.voidsetCharacterEncoding(String encoding) Overrides the name of the character encoding used in the body of this request.protected voidsetContextPath(String contextPath) protected voidsetContextPath(Request.PathResolver contextPath) voidsetCookies(org.glassfish.grizzly.http.Cookie[] cookies) Set the set of cookies received with this Request.protected voidsetHttpHandlerPath(String httpHandlerPath) protected voidsetHttpHandlerPath(Request.PathResolver httpHandlerPath) static voidsetMaxDispatchDepth(int depth) Static setter method for the maximum dispatch depthvoidSets the HTTP request method used in this Request.<E> voidsetNote(org.glassfish.grizzly.http.Note<E> note, E value) Bind theNotevalue to this Request, replacing any existing binding for this name.protected voidsetPathInfo(String pathInfo) protected voidsetPathInfo(Request.PathResolver pathInfo) voidsetQueryString(String queryString) Sets the query string associated with this request.voidsetRequestedSessionCookie(boolean flag) Set a flag indicating whether or not the requested session ID for this request came in through a cookie.voidSet the requested session ID for this request.voidsetRequestedSessionURL(boolean flag) Set a flag indicating whether or not the requested session ID for this request came in through a URL.protected voidsetRequestExecutorProvider(RequestExecutorProvider requestExecutorProvider) Sets @return theRequestExecutorProviderresponsible for executing user's code inHttpHandler.service(org.glassfish.grizzly.http.server.Request, org.glassfish.grizzly.http.server.Response)and notifyingReadHandler,WriteHandlerregistered by the user.voidsetRequestParameters(org.glassfish.grizzly.http.util.Parameters parameters) This method may be used if some other entity processed request parameters and wishes to expose them via the request.voidsetRequestURI(String uri) Sets the request URI for this request.voidsetServerName(String name) Set the name of the server (virtual host) to process this request.voidsetServerPort(int port) Set the port number of the server to process this request.voidsetSessionCookieName(String sessionCookieName) Set the session cookie name, if not set default JSESSIONID name will be usedprotected voidsetSessionManager(SessionManager sessionManager) SetSessionManager, null value impliesDefaultSessionManagervoidsetUserPrincipal(Principal principal) Set the Principal who has been authenticated for this Request.protected voidskipPostBody(int len) Skips the POST body of this request.protected String
-
Field Details
-
SEND_FILE_ENABLED_ATTR
Request attribute will be associated with a boolean value indicating whether or not it's possible to transfer aFileusing sendfile.- Since:
- 2.2
- See Also:
-
SEND_FILE_ATTR
The value of this request attribute, as set by the developer must be a
Filethat exists, is not a directory, and is readable. ThisFilewill be transferred using sendfile ifSEND_FILE_ENABLED_ATTRis true. If sendfile support isn't enabled, an IllegalStateException will be raised at runtime. TheHttpHandlerusing this functionality should refrain from writing content via the response.Note that once this attribute is set, the sendfile process will begin.
- Since:
- 2.2
- See Also:
-
SEND_FILE_START_OFFSET_ATTR
The value of this request attribute signifies the starting offset of the file transfer. If not specified, an offset of zero will be assumed. The type of the value must be
Long.NOTE: In order for this attribute to take effect, it must be set before the
SEND_FILE_ATTRis set.- Since:
- 2.2
- See Also:
-
SEND_FILE_WRITE_LEN_ATTR
The value of this request attribute signifies the total number of bytes to transfer. If not specified, the entire file will be transferred. The type of the value must be
LongNOTE: In order for this attribute to take effect, it must be set before the
SEND_FILE_ATTRis set.- Since:
- 2.2
- See Also:
-
request
protected org.glassfish.grizzly.http.HttpRequestPacket requestHTTP Request Packet -
ctx
protected org.glassfish.grizzly.filterchain.FilterChainContext ctx -
httpServerFilter
-
afterServicesList
-
cookies
protected org.glassfish.grizzly.http.Cookie[] cookiesThe set of cookies associated with this Request. -
rawCookies
protected org.glassfish.grizzly.http.Cookies rawCookies -
sessionCookieName
-
sessionManager
-
defaultLocale
The default Locale if none are specified. -
locales
The preferred Locales associated with this Request. -
dispatcherType
The current dispatcher type. -
inputBuffer
The associated input buffer. -
usingInputStream
protected boolean usingInputStreamUsing stream flag. -
usingReader
protected boolean usingReaderUsing writer flag. -
userPrincipal
User principal. -
sessionParsed
protected boolean sessionParsedSession parsed flag. -
requestParametersParsed
protected boolean requestParametersParsedRequest parameters parsed flag. -
cookiesParsed
protected boolean cookiesParsedCookies parsed flag. -
secure
protected boolean secureSecure flag. -
subject
The Subject associated with the current AccessControllerContext -
parameterMap
Hash map used in the getParametersMap method. -
parameters
protected final org.glassfish.grizzly.http.util.Parameters parameters -
requestDispatcherPath
The current request dispatcher path. -
requestedSessionCookie
protected boolean requestedSessionCookieWas the requested session ID received in a cookie? -
requestedSessionId
The requested session ID (if any) for this request. -
requestedSessionURL
protected boolean requestedSessionURLWas the requested session ID received in a URL? -
localesParsed
protected boolean localesParsedParse locales. -
response
The response with which this request is associated. -
trailers
Trailer headers, if any.
-
-
Constructor Details
-
Request
Deprecated.Temporarily introduce public constructor to fix GRIZZLY-1782. Just to make request instances proxiable. This constructor is not intended for client code consumption and should not be used explicitly as it creates an invalid instance. -
Request
-
-
Method Details
-
create
-
obtainMappingData
-
initialize
public void initialize(org.glassfish.grizzly.http.HttpRequestPacket request, org.glassfish.grizzly.filterchain.FilterChainContext ctx, HttpServerFilter httpServerFilter) -
getRequest
public org.glassfish.grizzly.http.HttpRequestPacket getRequest()- Returns:
- the Coyote request.
-
getResponse
- Returns:
- the Response with which this Request is associated.
-
getSessionCookieName
- Returns:
- session cookie name, if not set default JSESSIONID name will be used
-
setSessionCookieName
Set the session cookie name, if not set default JSESSIONID name will be used -
isPushEnabled
public boolean isPushEnabled()- Returns:
trueif HTTP/2 push is enabled, otherwise,false.
-
obtainSessionCookieName
- Returns:
sessionCookieNameif set, or the value returned bySessionManager.getSessionCookieName()ifsessionCookieNameis not set.
-
getSessionManager
- Returns:
SessionManager
-
setSessionManager
SetSessionManager, null value impliesDefaultSessionManager -
getRequestExecutor
- Returns:
- the
Executorresponsible for notifyingReadHandler,WriteHandlerassociated with this Request processing.
-
setRequestExecutorProvider
Sets @return theRequestExecutorProviderresponsible for executing user's code inHttpHandler.service(org.glassfish.grizzly.http.server.Request, org.glassfish.grizzly.http.server.Response)and notifyingReadHandler,WriteHandlerregistered by the user.- Parameters:
requestExecutorProvider-RequestExecutorProvider
-
addAfterServiceListener
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
Remove the "after-service" listener, which was previously added byaddAfterServiceListener(org.glassfish.grizzly.http.server.AfterServiceListener).- Parameters:
listener- the "after-service" listener, which was previously added byaddAfterServiceListener(org.glassfish.grizzly.http.server.AfterServiceListener).
-
onAfterService
protected void onAfterService() -
recycle
protected void recycle()Release all object references, and initialize instance variables, in preparation for reuse of this object. -
getAuthorization
- Returns:
- the authorization credentials sent with this request.
-
newPushBuilder
- Returns:
- a new
PushBuilderfor issuing server push responses from the current request. If the current connection does not support server push, or server push has been disabled by the client, it will returnnull.
-
replayPayload
public void replayPayload(org.glassfish.grizzly.Buffer buffer) Replays request's payload by setting new payloadBuffer. If request parameters have been parsed based on prev. request's POST payload - the parameters will be recycled and ready to be parsed again.- Parameters:
buffer- payload
-
createInputStream
public org.glassfish.grizzly.http.io.NIOInputStream createInputStream()Create and return a NIOInputStream to read the content associated with this Request.- Returns:
NIOInputStream
-
createNote
Create a namedNoteassociated with this Request.- Type Parameters:
E- theNotetype.- Parameters:
name- theNotename.- Returns:
- the
Note.
-
getNote
public <E> E getNote(org.glassfish.grizzly.http.Note<E> note) Return theNotevalue associated with this Request, ornullif no such binding exists. UsecreateNote(java.lang.String)to create a newNote.- Parameters:
note-Notevalue to be returned
-
getNoteNames
Return aSetcontaining the String names of all note bindings that exist for this request. UsecreateNote(java.lang.String)to create a newNote.- Returns:
- a
Setcontaining the String names of all note bindings that exist for this request.
-
removeNote
public <E> E removeNote(org.glassfish.grizzly.http.Note<E> note) Remove theNotevalue associated with this request. UsecreateNote(java.lang.String)to create a newNote.- Parameters:
note-Notevalue to be removed
-
setNote
public <E> void setNote(org.glassfish.grizzly.http.Note<E> note, E value) Bind theNotevalue to this Request, replacing any existing binding for this name. UsecreateNote(java.lang.String)to create a newNote.- Parameters:
note-Noteto which the object should be boundvalue- theNotevalue be bound to the specifiedNote.
-
setServerName
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
-
getHttpFilter
- Returns:
HttpServerFilter, which dispatched this request
-
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. ForHttpHandlers 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
-
setContextPath
-
getHttpHandlerPath
Returns the part of this request's URL that calls the HttpHandler. This includes either the HttpHandler name or a path to the HttpHandler, but does not include any extra path information or a query string.- Returns:
- a String containing the name or path of the HttpHandler being called, as specified in the request URL
- Throws:
IllegalStateException- if HttpHandler path was not set explicitly and attempt to URI-decodeRequestURIRef.getDecodedURI()failed.
-
setHttpHandlerPath
-
setHttpHandlerPath
-
getPathInfo
Returns any extra path information associated with the URL the client sent when it made this request. The extra path information follows the HttpHandler path but precedes the query string. This method returns null if there was no extra path information.- Returns:
- a String specifying extra path information that comes after the HttpHandler path but before the query string in the request URL; or null if the URL does not have any extra path information
-
setPathInfo
-
setPathInfo
-
getAttribute
Return the specified request attribute if it exists; otherwise, returnnull.- Parameters:
name- Name of the request attribute to return- Returns:
- the specified request attribute if it exists; otherwise, return
null.
-
getAttributeNames
Return the names of all request attributes for this Request, or an emptySetif there are none. -
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
Return the content type for this Request. -
getInputStream
Return the
By default the returnedInputStreamfor thisRequest.NIOInputStreamwill work as blockingInputStream, but it will be possible to callInputSource.isReady(),InputStream.available(), orInputSource.notifyAvailable(org.glassfish.grizzly.ReadHandler)to avoid blocking.- Returns:
- the
NIOInputStreamfor thisRequest. - Throws:
IllegalStateException- ifgetReader()orgetNIOReader()has already been called for this request.- Since:
- 2.2
-
getNIOInputStream
public org.glassfish.grizzly.http.io.NIOInputStream getNIOInputStream()Return the
NIOInputStreamfor thisRequest. 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
NIOInputStreamfor thisRequest. - Throws:
IllegalStateException- ifgetReader()orgetNIOReader()has already been called for this request.
-
requiresAcknowledgement
public boolean requiresAcknowledgement()- Returns:
trueif this request requires acknowledgment.
-
getLocale
Return the preferred Locale that the client will accept content in, based on the value for the firstAccept-Languageheader that was encountered. If the request did not specify a preferred language, the server's default Locale is returned. -
getLocales
Return the set of preferred Locales that the client will accept content in, based on the values for anyAccept-Languageheaders that were encountered. If the request did not specify a preferred language, the server's default Locale is returned. -
getParameters
public org.glassfish.grizzly.http.util.Parameters getParameters()Returns the low-level parameters holder for finer control over parameters.- Returns:
Parameters.
-
getParameter
Return the value of the specified request parameter, if any; otherwise, returnnull. If there is more than one value defined, return only the first one.- Parameters:
name- Name of the desired request parameter
-
getParameterMap
Returns aMapof 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
Mapcontaining parameter names as keys and parameter values as map values.
-
getParameterNames
Return the names of all defined request parameters for this request. -
getParameterValues
Return the defined values for the specified request parameter, if any; otherwise, returnnull.- Parameters:
name- Name of the desired request parameter
-
getProtocol
public org.glassfish.grizzly.http.Protocol getProtocol()Return the protocol and version used to make this Request. -
getReader
Returns the
By default the returnedReaderassociated with thisRequest.NIOReaderwill work as blockingReader, but it will be possible to callInputSource.isReady()orInputSource.notifyAvailable(org.glassfish.grizzly.ReadHandler)to avoid blocking.- Returns:
- the
NIOReaderassociated with thisRequest. - Throws:
IllegalStateException- ifgetInputStream()orgetNIOInputStream()has already been called for this request.- Since:
- 2.2
-
getNIOReader
public org.glassfish.grizzly.http.io.NIOReader getNIOReader()Returns the
NIOReaderassociated with thisRequest. ThisNIOReaderwill not block while reading content.- Returns:
NIOReader- Throws:
IllegalStateException- ifgetInputStream()orgetNIOInputStream()has already been called for this request.
-
getRemoteAddr
Return the remote IP address making this Request. -
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
Returns the host name of the Internet Protocol (IP) interface on which the request was received. -
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
- Returns:
- the scheme used to make this Request.
-
getServerName
- Returns:
- the server name responding to this Request.
-
getServerPort
public int getServerPort()- Returns:
- the server port responding to this Request.
-
isSecure
public boolean isSecure()- Returns:
- true if this request received on a secure connection
-
removeAttribute
Remove the specified request attribute if it exists.- Parameters:
name- Name of the request attribute to remove
-
setAttribute
Set the specified request attribute to the specified value.- Parameters:
name- Name of the request attribute to setvalue- The associated value
-
setCharacterEncoding
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 usinggetReader(). Otherwise, it has no effect.- Parameters:
encoding-Stringcontaining 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 -
getRequestId
- Returns:
- identifier of the request generated by this class.
-
getProtocolRequestId
- Returns:
- an empty string or identifier managed by the underlying protocol (HTTP2)
-
getConnection
public org.glassfish.grizzly.Connection<?> getConnection()- Returns:
- underlying connection used by the request
-
addCookie
public void addCookie(org.glassfish.grizzly.http.Cookie cookie) Add a Cookie to the set of Cookies associated with this Request.- Parameters:
cookie- The new cookie
-
addLocale
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
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 parametervalues- 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
Get the decoded request URI.- Returns:
- the URL decoded request URI
- Throws:
CharConversionException
-
setUserPrincipal
Set the Principal who has been authenticated for this Request. This value is also used to calculate the value to be returned by thegetRemoteUser()method.- Parameters:
principal- The user Principal
-
getAuthType
Return the authentication type used for this Request. -
getCookies
public org.glassfish.grizzly.http.Cookie[] getCookies()Return the set of Cookies received with this Request. -
setCookies
public void setCookies(org.glassfish.grizzly.http.Cookie[] cookies) Set the set of cookies received with this Request. -
getDateHeader
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
-
getDateHeader
public long getDateHeader(org.glassfish.grizzly.http.util.Header header) Return the value of the specified date header, if any; otherwise return -1.- Parameters:
header- the requested dateHeader- Throws:
IllegalArgumentException- if the specified header value cannot be converted to a date- Since:
- 2.1.2
-
getHeader
Return the first value of the specified header, if any; otherwise, returnnull- Parameters:
name- Name of the requested header
-
getHeader
Return the first value of the specified header, if any; otherwise, returnnull- Parameters:
header- the requestedHeader- Since:
- 2.1.2
-
getHeaders
Return all of the values of the specified header, if any; otherwise, return an empty enumeration.- Parameters:
name- Name of the requested header
-
getHeaders
Return all of the values of the specified header, if any; otherwise, return an empty enumeration.- Parameters:
header- the requestedHeader- Since:
- 2.1.2
-
getTrailers
Get the request trailer headers. Values may only be returned in the case of HTTP/1.1 when the request is using thetransfer-encodingchunkedor in HTTP/2 sends a secondHEADERSframe terminating the stream. An emptyMapwill be returned in all other cases. While headers are typical case insensitive, the headers stored in the returnedMapwill be done so in lower-case. This method should typically be called after the application has read the request body. It is safe to invoke this method if there is no body content.- Returns:
- A
Mapof trailers headers, if any were present. - Throws:
IllegalStateException- if neitherReadHandler.onAllDataRead()has been called or an EOF indication has been returned from thegetReader(),getNIOReader(),getInputStream(),getNIOInputStream().- Since:
- 2.4.0
- See Also:
-
areTrailersAvailable
public boolean areTrailersAvailable()- Returns:
trueif trailers are available to be accessed otherwise returnsfalse.- Since:
- 2.4.0
-
getHeaderNames
Return the names of all headers received with this request. -
getIntHeader
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
-
getIntHeader
public int getIntHeader(org.glassfish.grizzly.http.util.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 requestedHeader- Throws:
IllegalArgumentException- if the specified header value cannot be converted to an integer- Since:
- 2.1.2
-
getMethod
public org.glassfish.grizzly.http.Method getMethod()Return the HTTP request method used in this Request. -
setMethod
Sets the HTTP request method used in this Request.- Parameters:
method- the HTTP request method used in this Request.
-
getQueryString
- Returns:
- the query string associated with this request.
-
setQueryString
Sets the query string associated with this request.- Parameters:
queryString- the query string associated with this request.
-
getRemoteUser
Return the name of the remote user that has been authenticated for this Request. -
getRequestedSessionId
Return the session identifier included in this request, if any. -
getRequestURI
Return the request URI for this request. -
setRequestURI
Sets the request URI for this request.- Parameters:
uri- the request URI for this request.
-
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 aString, 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
StringBufferobject containing the reconstructed URL
-
appendRequestURL
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 aString, 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
StringBuilderobject containing the appended reconstructed URL
-
appendRequestURL
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 aString, 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
StringBufferobject containing the appended reconstructed URL
-
getUserPrincipal
Return the principal that has been authenticated for this Request. -
getContext
public org.glassfish.grizzly.filterchain.FilterChainContext getContext() -
unescape
-
parseCookies
protected void parseCookies()Parse cookies. -
getInputBuffer
public org.glassfish.grizzly.http.io.InputBuffer getInputBuffer()- Returns:
- the
InputBufferassociated with this request, which is the source forgetInputStream(),getReader(),getNIOInputStream(), andgetNIOReader()
-
setRequestParameters
public void setRequestParameters(org.glassfish.grizzly.http.util.Parameters parameters) This method may be used if some other entity processed request parameters and wishes to expose them via the request. When this method is called, it will mark the internal request parameter state as having been processed.- Parameters:
parameters- the parameters to expose via this request.- Since:
- 2.2
-
getRawCookies
protected org.glassfish.grizzly.http.Cookies getRawCookies()TODO DOCS -
parseRequestParameters
protected void parseRequestParameters()Parse request parameters. -
getPostBody
Gets the POST body of this request.- Returns:
- The POST body of this request
- Throws:
IOException
-
skipPostBody
Skips the POST body of this request.- Parameters:
len- how much of the POST body to skip.- Throws:
IOException
-
parseLocales
protected void parseLocales()Parse request locales. -
parseLocalesHeader
Parse accept-language header value. -
getJrouteId
Gets the jroute id of this request, which may have been sent as a separateJROUTEcookie 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
Return the session associated with this Request, creating one if necessary. -
getSession
Return the session associated with this Request, creating one if necessary and requested.- Parameters:
create- Create a new session if one does not exist
-
changeSessionId
Change the session id of the current session associated with this request and return the new session id.- Returns:
- the original session id
- Throws:
IllegalStateException- if there is no session associated with the request- Since:
- 2.3
-
doGetSession
-
isRequestedSessionIdFromCookie
public boolean isRequestedSessionIdFromCookie()- Returns:
trueif the session identifier included in this request came from a cookie.
-
isRequestedSessionIdFromURL
public boolean isRequestedSessionIdFromURL()Returntrueif the session identifier included in this request came from the request URI. -
isRequestedSessionIdValid
public boolean isRequestedSessionIdValid()- Returns:
- true if the session identifier included in this request identifies a valid session.
-
configureSessionCookie
protected void configureSessionCookie(org.glassfish.grizzly.http.Cookie cookie) Configures the given session cookie.- Parameters:
cookie- The session 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
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
-