Package org.apache.catalina.connector
Class Request
- java.lang.Object
-
- org.apache.catalina.connector.Request
-
- All Implemented Interfaces:
jakarta.servlet.http.HttpServletRequest
,jakarta.servlet.ServletRequest
,HttpRequest
,Request
- Direct Known Subclasses:
PwcCoyoteRequest
public class Request extends Object implements HttpRequest, jakarta.servlet.http.HttpServletRequest
Wrapper object for the Coyote request.- Version:
- $Revision: 1.67.2.9 $ $Date: 2008/04/17 18:37:34 $
- Author:
- Remy Maucherat, Craig R. McClanahan, Rajiv Mordani
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<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 boolean
checkRestrictedResources
Whether or not access to resources in WEB-INF or META-INF needs to be checked.protected boolean
checkUnsuccessfulSessionFind
protected Connector
connector
Associated Catalina connector.protected Context
context
Associated context.protected ArrayList<jakarta.servlet.http.Cookie>
cookies
The set of cookies associated with this Request.protected boolean
cookiesParsed
Cookies parsed flag.protected org.glassfish.grizzly.http.server.Request
coyoteRequest
Coyote request.protected RequestFacade
defaultContextMaskingFacade
Request facade that masks the fact that a request received at the root context was mapped to a default-web-module (if such a mapping exists).protected static Locale
defaultLocale
The default Locale if none are specified.static boolean
discardDisconnectEvent
protected Object
dispatcherTypeAttr
The current dispatcher type.protected RequestFacade
facade
The facade associated with this request.protected jakarta.servlet.FilterChain
filterChain
Filter chain associated with the request.protected SimpleDateFormat[]
formats
protected GlassFishValve
hostValve
protected static String
info
Descriptive information about this Request implementation.protected InputBuffer
inputBuffer
The associated input buffer.protected CoyoteInputStream
inputStream
ServletInputStream.protected String
localAddr
Local addressprotected ArrayList<Locale>
locales
The preferred Locales associated with this Request.protected boolean
localesParsed
Parse locales.protected String
localName
Local addressprotected int
localPort
Local portprotected org.glassfish.grizzly.http.server.util.MappingData
mappingData
Mapping data.protected ParameterMap<String,String[]>
parameterMap
Hash map used in the getParametersMap method.protected boolean
parametersProcessed
protected byte[]
postData
protected CoyoteReader
reader
Reader.protected String
remoteAddr
Remote address.protected String
remoteHost
Remote host.protected int
remotePort
Remote portprotected Object
requestDispatcherPath
The current request dispatcher path.protected boolean
requestedSessionCookie
Was the requested session ID received in a cookie?protected String
requestedSessionCookiePath
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 String
requestedSessionVersion
The requested session version (if any) for this request.protected Response
response
The response with which this request is associated.protected boolean
secure
Secure flag.protected jakarta.servlet.ServletContext
servletContext
protected Session
session
The currently active session for this request.protected boolean
sessionParsed
Session parsed flag.protected Socket
socket
The socket through which this Request was received.protected Subject
subject
The Subject associated with the current AccessControllerContextprotected org.glassfish.grizzly.http.util.B2CConverter
URIConverter
URI byte to char converter (not recycled).protected org.glassfish.grizzly.http.util.CharChunk
uriParamsCC
protected Principal
userPrincipal
User principal.protected boolean
usingInputStream
Using stream flag.protected boolean
usingReader
Using writer flag.protected Wrapper
wrapper
Associated wrapper.
-
Constructor Summary
Constructors Constructor Description Request()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addCookie(jakarta.servlet.http.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.boolean
authenticate(jakarta.servlet.http.HttpServletResponse response)
String
changeSessionId()
Change the session id of the current session associated with this request and return the new session id.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 and reset the query string encoding charset.protected void
configureSessionCookie(jakarta.servlet.http.Cookie cookie)
Configures the given JSESSIONID cookie.protected void
convertURI(org.glassfish.grizzly.http.util.MessageBytes uri)
Character conversion of the URI.jakarta.servlet.ServletInputStream
createInputStream()
Create and return a ServletInputStream to read the content associated with this Request.int
decrementDispatchDepth()
Decrement the depth of application dispatchvoid
disableAsyncSupport()
Disables async support for this request.protected Session
doGetSession(boolean create)
void
finishRequest()
Perform whatever actions are required to flush and close the input stream or reader, in a single operation.String
generateSessionId()
This object does not implement a session ID generator.jakarta.servlet.AsyncContext
getAsyncContext()
Gets the AsyncContext of this request.Object
getAttribute(String name)
Return the specified request attribute if it exists; otherwise, returnnull
.Enumeration<String>
getAttributeNames()
Return the names of all request attributes for this Request, or an emptyEnumeration
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.boolean
getCheckRestrictedResources()
Return whether or not access to resources under WEB-INF or META-INF needs to be checked.Connector
getConnector()
Return the Connector through which this Request was received.int
getContentLength()
Return the content length for this Request.long
getContentLengthLong()
Return the content length for this Request.String
getContentType()
Return the content type for this Request.Context
getContext()
Return the Context within which this Request is being processed.String
getContextPath()
Return the portion of the request URI used to select the Context of the Request.String
getContextPath(boolean maskDefaultContextMapping)
Gets the portion of the request URI used to select the Context of the Request.jakarta.servlet.http.Cookie[]
getCookies()
Return the set of Cookies received with this Request.org.glassfish.grizzly.http.server.Request
getCoyoteRequest()
Get the Coyote 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
getDecodedRequestURI(boolean maskDefaultContextMapping)
Gets the decoded request URI.jakarta.servlet.DispatcherType
getDispatcherType()
jakarta.servlet.FilterChain
getFilterChain()
Get filter chain associated with the request.String
getHeader(String name)
Return the first value of the specified header, if any; otherwise, returnnull
Enumeration<String>
getHeaderNames()
Return the names of all headers received with this request.Enumeration<String>
getHeaders(String name)
Return all of the values of the specified header, if any; otherwise, return an empty enumeration.Host
getHost()
Return the Host within which this Request is being processed.jakarta.servlet.http.HttpServletMapping
getHttpServletMapping()
jakarta.servlet.http.HttpUpgradeHandler
getHttpUpgradeHandler()
String
getInfo()
Return descriptive information about this Request implementation and the corresponding version number, in the format<description>/<version>
.jakarta.servlet.ServletInputStream
getInputStream()
Return the servlet input stream for this Request.int
getIntHeader(String headerName)
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 separateJROUTE
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 firstAccept-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 anyAccept-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.org.glassfish.grizzly.http.server.util.MappingData
getMappingData()
Return mapping data.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, ornull
if no such binding exists.Iterator<String>
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, returnnull
.Map<String,String[]>
getParameterMap()
Returns aMap
of the parameters of this request.Enumeration<String>
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, returnnull
.jakarta.servlet.http.Part
getPart(String name)
Collection<jakarta.servlet.http.Part>
getParts()
String
getPathInfo()
Return the path information associated with this Request.String
getPathTranslated()
Return the extra path information for this request, translated to a real path.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
getRealPath(String path)
Deprecated.As of version 2.1 of the Java Servlet API, useServletContext.getRealPath()
.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.jakarta.servlet.http.HttpServletRequest
getRequest()
Gets theServletRequest
for which this object is the facade.jakarta.servlet.http.HttpServletRequest
getRequest(boolean maskDefaultContextMapping)
Gets theServletRequest
for which this object is the facade.jakarta.servlet.RequestDispatcher
getRequestDispatcher(String path)
Return a RequestDispatcher that wraps the resource at the specified path, which may be interpreted as relative to the current request path.String
getRequestedSessionId()
Return the session identifier included in this request, if any.org.glassfish.grizzly.http.util.DataChunk
getRequestPathMB()
Get the request path.String
getRequestURI()
Return the request URI for this request.String
getRequestURI(boolean maskDefaultContextMapping)
Gets the request URI for this request.StringBuffer
getRequestURL()
Reconstructs the URL the client used to make the request.StringBuffer
getRequestURL(boolean maskDefaultContextMapping)
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.jakarta.servlet.ServletContext
getServletContext()
Gets the servlet context to which this servlet request was last dispatched.String
getServletPath()
Return the portion of the request URI used to select the servlet that will process this request.jakarta.servlet.http.HttpSession
getSession()
Return the session associated with this Request, creating one if necessary.jakarta.servlet.http.HttpSession
getSession(boolean create)
Return the session associated with this Request, creating one if necessary and requested.Session
getSessionInternal()
Return the session associated with this Request, creating one if necessary.Session
getSessionInternal(boolean create)
Gets 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.Map<String,String>
getTrailerFields()
boolean
getUnsuccessfulSessionFind()
Get the unsuccessfulSessionFind flag.protected org.glassfish.grizzly.http.util.B2CConverter
getURIConverter()
Return the URI converter.Principal
getUserPrincipal()
Return the principal that has been authenticated for this Request.jakarta.servlet.http.WebConnection
getWebConnection()
Wrapper
getWrapper()
Return the Wrapper within which this Request is being processed.int
incrementDispatchDepth()
Increment the depth of application dispatchvoid
initialiseHttpUpgradeHandler(jakarta.servlet.http.WebConnection wc)
protected static boolean
isAlpha(String value)
boolean
isAsyncStarted()
Checks whether async processing has started on this request.boolean
isAsyncSupported()
Checks whether this request supports async.boolean
isMaxDispatchDepthReached()
Check if the application dispatching has reached the maximumboolean
isRequestedSessionIdFromCookie()
Returntrue
if the session identifier included in this request came from a cookie.boolean
isRequestedSessionIdFromSecureCookie()
boolean
isRequestedSessionIdFromUrl()
Deprecated.As of Version 2.1 of the Java Servlet API, useisRequestedSessionIdFromURL()
instead.boolean
isRequestedSessionIdFromURL()
Returntrue
if the session identifier included in this request came from the request URI.boolean
isRequestedSessionIdValid()
Returntrue
if the session identifier included in this request identifies a valid session.boolean
isSecure()
Was this request received on a secure connection?boolean
isTrailerFieldsReady()
boolean
isUpgrade()
boolean
isUserInRole(String role)
Returntrue
if the authenticated user principal possesses the specified role name.Session
lockSession()
lock the session associated with this request this will be a foreground lock checks for background lock to clear and does a decay poll loop to wait until it is clear; after 5 times it takes control for the foregroundvoid
login(String username, char[] password)
void
login(String username, String password)
void
logout()
protected jakarta.servlet.http.Cookie
makeCookie(org.glassfish.grizzly.http.Cookie scookie)
protected jakarta.servlet.http.Cookie
makeCookie(org.glassfish.grizzly.http.Cookie scookie, boolean decode)
jakarta.servlet.http.PushBuilder
newPushBuilder()
protected void
obtainSessionId()
Take the session id from Grizzly Requestprotected void
parseCookies()
Parse cookies.protected void
parseJReplica(org.glassfish.grizzly.http.util.CharChunk uriCC)
Parses and removes jreplica (if present) from the request URI.protected void
parseSessionCookiesId()
Parse session id in URL.protected void
parseSessionId(String sessionParameterName, org.glassfish.grizzly.http.util.CharChunk uriBB)
Parse session id in URL.protected void
parseSessionVersion(org.glassfish.grizzly.http.util.CharChunk uriCC)
Parses and removes any session version (if present) 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
replayPayload(byte[] payloadByteArray)
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 tonull
.void
setCharacterEncoding(String enc)
Overrides the name of the character encoding used in the body of this request.void
setCheckRestrictedResources(boolean check)
Set whether or not access to resources under WEB-INF or META-INF needs to be checked.void
setConnector(Connector connector)
Set the Connector through which this Request was received.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
setContext(Context context)
Set the Context within which this Request is being processed.void
setCookies(jakarta.servlet.http.Cookie[] cookies)
Set the set of cookies received with this Request.void
setCoyoteRequest(org.glassfish.grizzly.http.server.Request grizzlyRequest)
Set the Coyote request.void
setDefaultContext(boolean isDefaultContext)
static void
setEnforceScope(boolean enforce)
Set whether or not to enforce scope checking of this object.void
setFilterChain(jakarta.servlet.FilterChain filterChain)
Set filter chain associated with the request.void
setHost(Host host)
Set the Host within which this Request is being processed.void
setMappingData(org.glassfish.grizzly.http.server.util.MappingData mappingData)
Set the mapping data for this Request.static void
setMaxDispatchDepth(int depth)
Static setter method for the maximum dispatch depthvoid
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
setPathInfo(String pathInfo)
Set the path information for this Request.void
setProtocol(String protocol)
Set the protocol name and version associated with this Request.void
setQueryString(String query)
Sets 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
setRequestedSessionCookie(boolean flag)
Set a flag indicating whether or not the requested session ID for this request came in through a cookie.void
setRequestedSessionCookiePath(String cookiePath)
Sets the requested session cookie path, see IT 7426void
setRequestedSessionId(String id)
Set the requested session ID for this request.void
setRequestedSessionIdFromSecureCookie(boolean secure)
Marks (or unmarks) this request as having a JSESSIONID cookie that is marked as securevoid
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(Response response)
Set the Response with which this Request is associated.void
setSecure(boolean secure)
Set the value to be returned byisSecure()
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
setServletPath(String servletPath)
Sets the servlet path for this Request.void
setSession(Session newSess)
set the session - this method is not for general usevoid
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
setUnsuccessfulSessionFind(boolean unsuccessfulSessionFind)
Set the unsuccessfulSessionFind flag.void
setUpgrade(boolean upgrade)
protected void
setURIConverter(org.glassfish.grizzly.http.util.B2CConverter URIConverter)
Set the URI converter.void
setUserPrincipal(Principal principal)
Set the Principal who has been authenticated for this Request.void
setWebConnection(jakarta.servlet.http.WebConnection wc)
void
setWrapper(Wrapper wrapper)
Set the Wrapper within which this Request is being processed.jakarta.servlet.AsyncContext
startAsync()
Starts async processing on this request.jakarta.servlet.AsyncContext
startAsync(jakarta.servlet.ServletRequest servletRequest, jakarta.servlet.ServletResponse servletResponse)
Starts async processing on this request.void
unlockSession()
unlock the session associated with this requestvoid
updatePaths(org.glassfish.grizzly.http.server.util.MappingData md)
Update this instance with the content of theMappingData
MappingData
<T extends jakarta.servlet.http.HttpUpgradeHandler>
Tupgrade(Class<T> handlerClass)
Create an instance ofHttpUpgradeHandler
for an given class and uses it for the http protocol upgrade processing.
-
-
-
Field Detail
-
info
protected static final String info
Descriptive information about this Request implementation.- See Also:
- Constant Field Values
-
formats
protected SimpleDateFormat[] formats
-
cookies
protected ArrayList<jakarta.servlet.http.Cookie> cookies
The set of cookies associated with this Request.
-
defaultLocale
protected static final Locale defaultLocale
The default Locale if none are specified.
-
attributes
protected Map<String,Object> attributes
The attributes associated with this Request, keyed by attribute name.
-
authType
protected String authType
Authentication type.
-
dispatcherTypeAttr
protected Object dispatcherTypeAttr
The current dispatcher type.
-
inputBuffer
protected InputBuffer inputBuffer
The associated input buffer.
-
inputStream
protected CoyoteInputStream inputStream
ServletInputStream.
-
reader
protected CoyoteReader 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
Session parsed flag.
-
parametersProcessed
protected boolean parametersProcessed
-
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 final int CACHED_POST_LEN
Post data buffer.- See Also:
- Constant Field Values
-
postData
protected byte[] postData
-
parameterMap
protected ParameterMap<String,String[]> parameterMap
Hash map used in the getParametersMap method.
-
session
protected Session session
The currently active session for this request.
-
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.
-
requestedSessionVersion
protected String requestedSessionVersion
The requested session version (if any) for this request.
-
requestedSessionCookiePath
protected String requestedSessionCookiePath
-
uriParamsCC
protected org.glassfish.grizzly.http.util.CharChunk uriParamsCC
-
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
-
checkRestrictedResources
protected boolean checkRestrictedResources
Whether or not access to resources in WEB-INF or META-INF needs to be checked.
-
checkUnsuccessfulSessionFind
protected boolean checkUnsuccessfulSessionFind
-
coyoteRequest
protected org.glassfish.grizzly.http.server.Request coyoteRequest
Coyote request.
-
facade
protected RequestFacade facade
The facade associated with this request.
-
defaultContextMaskingFacade
protected RequestFacade defaultContextMaskingFacade
Request facade that masks the fact that a request received at the root context was mapped to a default-web-module (if such a mapping exists). For example, its getContextPath() will return "/" rather than the context root of the default-web-module.
-
response
protected Response response
The response with which this request is associated.
-
connector
protected Connector connector
Associated Catalina connector.
-
mappingData
protected org.glassfish.grizzly.http.server.util.MappingData mappingData
Mapping data.
-
wrapper
protected Wrapper wrapper
Associated wrapper.
-
filterChain
protected jakarta.servlet.FilterChain filterChain
Filter chain associated with the request.
-
context
protected Context context
Associated context.
-
servletContext
protected jakarta.servlet.ServletContext servletContext
-
hostValve
protected GlassFishValve hostValve
-
discardDisconnectEvent
public static final boolean discardDisconnectEvent
-
URIConverter
protected org.glassfish.grizzly.http.util.B2CConverter URIConverter
URI byte to char converter (not recycled).
-
-
Method Detail
-
setCoyoteRequest
public void setCoyoteRequest(org.glassfish.grizzly.http.server.Request grizzlyRequest)
Set the Coyote request.- Parameters:
grizzlyRequest
- The Coyote request
-
getCoyoteRequest
public org.glassfish.grizzly.http.server.Request getCoyoteRequest()
Get the Coyote request.
-
setEnforceScope
public static void setEnforceScope(boolean enforce)
Set whether or not to enforce scope checking of this object.
-
recycle
public void recycle()
Release all object references, and initialize instance variables, in preparation for reuse of this object.
-
setUnsuccessfulSessionFind
public void setUnsuccessfulSessionFind(boolean unsuccessfulSessionFind)
Set the unsuccessfulSessionFind flag.- Parameters:
unsuccessfulSessionFind
-
-
getUnsuccessfulSessionFind
public boolean getUnsuccessfulSessionFind()
Get the unsuccessfulSessionFind flag.
-
setUpgrade
public void setUpgrade(boolean upgrade)
-
isUpgrade
public boolean isUpgrade()
-
getHttpUpgradeHandler
public jakarta.servlet.http.HttpUpgradeHandler getHttpUpgradeHandler()
-
getAuthorization
public String getAuthorization()
Return the authorization credentials sent with this request.- Specified by:
getAuthorization
in interfaceRequest
-
getConnector
public Connector getConnector()
Return the Connector through which this Request was received.- Specified by:
getConnector
in interfaceRequest
-
setConnector
public void setConnector(Connector connector)
Set the Connector through which this Request was received.- Specified by:
setConnector
in interfaceRequest
- Parameters:
connector
- The new connector
-
getContext
public Context getContext()
Return the Context within which this Request is being processed.- Specified by:
getContext
in interfaceRequest
-
setContext
public void setContext(Context context)
Set the Context within which this Request is being processed. This must be called as soon as the appropriate Context is identified, because it identifies the value to be returned bygetContextPath()
, and thus enables parsing of the request URI.- Specified by:
setContext
in interfaceRequest
- Parameters:
context
- The newly associated Context
-
setDefaultContext
public void setDefaultContext(boolean isDefaultContext)
- Parameters:
isDefaultContext
- true if this request was mapped to a context with an empty context root that is backed by the vitual server's default-web-module
-
getFilterChain
public jakarta.servlet.FilterChain getFilterChain()
Get filter chain associated with the request.- Specified by:
getFilterChain
in interfaceRequest
-
setFilterChain
public void setFilterChain(jakarta.servlet.FilterChain filterChain)
Set filter chain associated with the request.- Specified by:
setFilterChain
in interfaceRequest
- Parameters:
filterChain
- new filter chain
-
getHost
public Host getHost()
Return the Host within which this Request is being processed.
-
setHost
public void setHost(Host host)
Set the Host within which this Request is being processed. This must be called as soon as the appropriate Host is identified, and before the Request is passed to a context.
-
getHttpServletMapping
public jakarta.servlet.http.HttpServletMapping getHttpServletMapping()
- Specified by:
getHttpServletMapping
in interfacejakarta.servlet.http.HttpServletRequest
-
getInfo
public String getInfo()
Return descriptive information about this Request implementation and the corresponding version number, in the format<description>/<version>
.
-
getMappingData
public org.glassfish.grizzly.http.server.util.MappingData getMappingData()
Return mapping data.
-
setMappingData
public void setMappingData(org.glassfish.grizzly.http.server.util.MappingData mappingData)
Set the mapping data for this Request.
-
updatePaths
public void updatePaths(org.glassfish.grizzly.http.server.util.MappingData md)
Update this instance with the content of theMappingData
MappingData
-
getRequest
public jakarta.servlet.http.HttpServletRequest getRequest()
Gets theServletRequest
for which this object is the facade. This method must be implemented by a subclass.- Specified by:
getRequest
in interfaceRequest
-
getRequest
public jakarta.servlet.http.HttpServletRequest getRequest(boolean maskDefaultContextMapping)
Gets theServletRequest
for which this object is the facade. This method must be implemented by a subclass.- Specified by:
getRequest
in interfaceRequest
- Parameters:
maskDefaultContextMapping
- true if the fact that a request received at the root context was mapped to a default-web-module will be masked, false otherwise
-
getResponse
public Response getResponse()
Return the Response with which this Request is associated.- Specified by:
getResponse
in interfaceRequest
-
setResponse
public void setResponse(Response response)
Set the Response with which this Request is associated.- Specified by:
setResponse
in interfaceRequest
- Parameters:
response
- The new associated response
-
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.
-
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.
-
getURIConverter
protected org.glassfish.grizzly.http.util.B2CConverter getURIConverter()
Return the URI converter.
-
setURIConverter
protected void setURIConverter(org.glassfish.grizzly.http.util.B2CConverter URIConverter)
Set the URI converter.- Parameters:
URIConverter
- the new URI converter
-
getWrapper
public Wrapper getWrapper()
Return the Wrapper within which this Request is being processed.- Specified by:
getWrapper
in interfaceRequest
-
setWrapper
public void setWrapper(Wrapper wrapper)
Set the Wrapper within which this Request is being processed. This must be called as soon as the appropriate Wrapper is identified, and before the Request is ultimately passed to an application servlet.- Specified by:
setWrapper
in interfaceRequest
- Parameters:
wrapper
- The newly associated Wrapper
-
createInputStream
public jakarta.servlet.ServletInputStream createInputStream() throws IOException
Create and return a ServletInputStream to read the content associated with this Request.- Specified by:
createInputStream
in interfaceRequest
- 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.- Specified by:
finishRequest
in interfaceRequest
- 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, ornull
if no such binding exists.
-
getNoteNames
public Iterator<String> getNoteNames()
Return an Iterator containing the String names of all notes bindings that exist for this request.- Specified by:
getNoteNames
in interfaceRequest
- Returns:
- Iterator containing the String names
-
removeNote
public void removeNote(String name)
Remove any object bound to the specified name in the internal notes for this request.- Specified by:
removeNote
in interfaceRequest
- 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.
-
setContentLength
public void setContentLength(int length)
Set the content length associated with this Request.- Specified by:
setContentLength
in interfaceRequest
- 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
.- Specified by:
setContentType
in interfaceRequest
- Parameters:
type
- The new content type
-
setProtocol
public void setProtocol(String protocol)
Set the protocol name and version associated with this Request.- Specified by:
setProtocol
in interfaceRequest
- Parameters:
protocol
- Protocol name and version
-
setRemoteAddr
public void setRemoteAddr(String remoteAddr)
Set the IP address of the remote client associated with this Request.- Specified by:
setRemoteAddr
in interfaceRequest
- 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
-
setSecure
public void setSecure(boolean secure)
Set the value to be returned byisSecure()
for this Request.
-
setServerName
public void setServerName(String name)
Set the name of the server (virtual host) to process this request.- Specified by:
setServerName
in interfaceRequest
- Parameters:
name
- The server name
-
setServerPort
public void setServerPort(int port)
Set the port number of the server to process this request.- Specified by:
setServerPort
in interfaceRequest
- Parameters:
port
- The server port
-
setCheckRestrictedResources
public void setCheckRestrictedResources(boolean check)
Set whether or not access to resources under WEB-INF or META-INF needs to be checked.- Specified by:
setCheckRestrictedResources
in interfaceRequest
-
getCheckRestrictedResources
public boolean getCheckRestrictedResources()
Return whether or not access to resources under WEB-INF or META-INF needs to be checked.- Specified by:
getCheckRestrictedResources
in interfaceRequest
-
getAttribute
public Object getAttribute(String name)
Return the specified request attribute if it exists; otherwise, returnnull
.- Specified by:
getAttribute
in interfacejakarta.servlet.ServletRequest
- Parameters:
name
- Name of the request attribute to return
-
getAttributeNames
public Enumeration<String> getAttributeNames()
Return the names of all request attributes for this Request, or an emptyEnumeration
if there are none.- Specified by:
getAttributeNames
in interfacejakarta.servlet.ServletRequest
-
getCharacterEncoding
public String getCharacterEncoding()
Return the character encoding for this Request.- Specified by:
getCharacterEncoding
in interfacejakarta.servlet.ServletRequest
-
getContentLength
public int getContentLength()
Return the content length for this Request.- Specified by:
getContentLength
in interfacejakarta.servlet.ServletRequest
-
getContentLengthLong
public long getContentLengthLong()
Return the content length for this Request.- Specified by:
getContentLengthLong
in interfacejakarta.servlet.ServletRequest
-
getContentType
public String getContentType()
Return the content type for this Request.- Specified by:
getContentType
in interfacejakarta.servlet.ServletRequest
-
getInputStream
public jakarta.servlet.ServletInputStream getInputStream() throws IOException
Return the servlet input stream for this Request. The default implementation returns a servlet input stream created bycreateInputStream()
.- Specified by:
getInputStream
in interfacejakarta.servlet.ServletRequest
- Throws:
IllegalStateException
- ifgetReader()
has already been called for this requestIOException
- 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 firstAccept-Language
header that was encountered. If the request did not specify a preferred language, the server's default Locale is returned.- Specified by:
getLocale
in interfacejakarta.servlet.ServletRequest
-
getLocales
public Enumeration<Locale> getLocales()
Return the set of preferred Locales that the client will accept content in, based on the values for anyAccept-Language
headers that were encountered. If the request did not specify a preferred language, the server's default Locale is returned.- Specified by:
getLocales
in interfacejakarta.servlet.ServletRequest
-
getParameter
public String getParameter(String name)
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.- Specified by:
getParameter
in interfacejakarta.servlet.ServletRequest
- Parameters:
name
- Name of the desired request parameter
-
getParameterMap
public Map<String,String[]> getParameterMap()
Returns aMap
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.- Specified by:
getParameterMap
in interfacejakarta.servlet.ServletRequest
- Returns:
- A
Map
containing parameter names as keys and parameter values as map values.
-
getParameterNames
public Enumeration<String> getParameterNames()
Return the names of all defined request parameters for this request.- Specified by:
getParameterNames
in interfacejakarta.servlet.ServletRequest
-
getParameterValues
public String[] getParameterValues(String name)
Return the defined values for the specified request parameter, if any; otherwise, returnnull
.- Specified by:
getParameterValues
in interfacejakarta.servlet.ServletRequest
- Parameters:
name
- Name of the desired request parameter
-
getProtocol
public String getProtocol()
Return the protocol and version used to make this Request.- Specified by:
getProtocol
in interfacejakarta.servlet.ServletRequest
-
getReader
public BufferedReader getReader() throws IOException
Read the Reader wrapping the input stream for this Request. The default implementation wraps aBufferedReader
around the servlet input stream returned bycreateInputStream()
.- Specified by:
getReader
in interfacejakarta.servlet.ServletRequest
- Throws:
IllegalStateException
- ifgetInputStream()
has already been called for this requestIOException
- if an input/output error occurs
-
getRealPath
public String getRealPath(String path)
Deprecated.As of version 2.1 of the Java Servlet API, useServletContext.getRealPath()
.Return the real path of the specified virtual path.- Specified by:
getRealPath
in interfacejakarta.servlet.ServletRequest
- Parameters:
path
- Path to be translated
-
getRemoteAddr
public String getRemoteAddr()
Return the remote IP address making this Request.- Specified by:
getRemoteAddr
in interfacejakarta.servlet.ServletRequest
-
getRemoteHost
public String getRemoteHost()
Return the remote host name making this Request.- Specified by:
getRemoteHost
in interfacejakarta.servlet.ServletRequest
-
getRemotePort
public int getRemotePort()
Returns the Internet Protocol (IP) source port of the client or last proxy that sent the request.- Specified by:
getRemotePort
in interfacejakarta.servlet.ServletRequest
-
getLocalName
public String getLocalName()
Returns the host name of the Internet Protocol (IP) interface on which the request was received.- Specified by:
getLocalName
in interfacejakarta.servlet.ServletRequest
-
getLocalAddr
public String getLocalAddr()
Returns the Internet Protocol (IP) address of the interface on which the request was received.- Specified by:
getLocalAddr
in interfacejakarta.servlet.ServletRequest
-
getLocalPort
public int getLocalPort()
Returns the Internet Protocol (IP) port number of the interface on which the request was received.- Specified by:
getLocalPort
in interfacejakarta.servlet.ServletRequest
-
getRequestDispatcher
public jakarta.servlet.RequestDispatcher getRequestDispatcher(String path)
Return a RequestDispatcher that wraps the resource at the specified path, which may be interpreted as relative to the current request path.- Specified by:
getRequestDispatcher
in interfacejakarta.servlet.ServletRequest
- Parameters:
path
- Path of the resource to be wrapped
-
getScheme
public String getScheme()
Return the scheme used to make this Request.- Specified by:
getScheme
in interfacejakarta.servlet.ServletRequest
-
getServerName
public String getServerName()
Return the server name responding to this Request.- Specified by:
getServerName
in interfacejakarta.servlet.ServletRequest
-
getServerPort
public int getServerPort()
Return the server port responding to this Request.- Specified by:
getServerPort
in interfacejakarta.servlet.ServletRequest
-
isSecure
public boolean isSecure()
Was this request received on a secure connection?- Specified by:
isSecure
in interfacejakarta.servlet.ServletRequest
-
removeAttribute
public void removeAttribute(String name)
Remove the specified request attribute if it exists.- Specified by:
removeAttribute
in interfacejakarta.servlet.ServletRequest
- 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.- Specified by:
setAttribute
in interfacejakarta.servlet.ServletRequest
- Parameters:
name
- Name of the request attribute to setvalue
- 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 usinggetReader()
. Otherwise, it has no effect.- Specified by:
setCharacterEncoding
in interfacejakarta.servlet.ServletRequest
- Parameters:
enc
-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
-
authenticate
public boolean authenticate(jakarta.servlet.http.HttpServletResponse response) throws IOException, jakarta.servlet.ServletException
- Specified by:
authenticate
in interfacejakarta.servlet.http.HttpServletRequest
- Throws:
IOException
jakarta.servlet.ServletException
-
login
public void login(String username, String password) throws jakarta.servlet.ServletException
- Specified by:
login
in interfacejakarta.servlet.http.HttpServletRequest
- Throws:
jakarta.servlet.ServletException
-
login
public void login(String username, char[] password) throws jakarta.servlet.ServletException
- Throws:
jakarta.servlet.ServletException
-
logout
public void logout() throws jakarta.servlet.ServletException
- Specified by:
logout
in interfacejakarta.servlet.http.HttpServletRequest
- Throws:
jakarta.servlet.ServletException
-
addCookie
public void addCookie(jakarta.servlet.http.Cookie cookie)
Add a Cookie to the set of Cookies associated with this Request.- Specified by:
addCookie
in interfaceHttpRequest
- 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.- Specified by:
addHeader
in interfaceHttpRequest
- Parameters:
name
- The new header namevalue
- 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().- Specified by:
addLocale
in interfaceHttpRequest
- 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).- Specified by:
addParameter
in interfaceHttpRequest
- 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.- Specified by:
clearCookies
in interfaceHttpRequest
-
clearHeaders
public void clearHeaders()
Clear the collection of Headers associated with this Request.- Specified by:
clearHeaders
in interfaceHttpRequest
-
clearLocales
public void clearLocales()
Clear the collection of Locales associated with this Request.- Specified by:
clearLocales
in interfaceHttpRequest
-
clearParameters
public void clearParameters()
Clear the collection of parameters associated with this Request and reset the query string encoding charset.- Specified by:
clearParameters
in interfaceHttpRequest
-
replayPayload
public void replayPayload(byte[] payloadByteArray)
- Specified by:
replayPayload
in interfaceHttpRequest
-
setAuthType
public void setAuthType(String type)
Set the authentication type used for this request, if any; otherwise set the type tonull
. Typical values are "BASIC", "DIGEST", or "SSL".- Specified by:
setAuthType
in interfaceHttpRequest
- Parameters:
type
- The authentication type used
-
setMethod
public void setMethod(String method)
Set the HTTP request method used for this Request.Used by FBL when the original request is restored after successful authentication.
- Specified by:
setMethod
in interfaceHttpRequest
- Parameters:
method
- The request method
-
setQueryString
public void setQueryString(String query)
Sets the query string for this Request.Used by FBL when the original request is restored after successful authentication.
- Specified by:
setQueryString
in interfaceHttpRequest
- Parameters:
query
- The query string
-
setPathInfo
public void setPathInfo(String pathInfo)
Set the path information for this Request.- Specified by:
setPathInfo
in interfaceHttpRequest
- Parameters:
pathInfo
- The path information
-
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.- Specified by:
setRequestedSessionCookie
in interfaceHttpRequest
- Parameters:
flag
- The new flag
-
setRequestedSessionCookiePath
public void setRequestedSessionCookiePath(String cookiePath)
Sets the requested session cookie path, see IT 7426- Specified by:
setRequestedSessionCookiePath
in interfaceRequest
-
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. This method, which is called when the session id is sent as a cookie, or when it is encoded in the request URL, removes a jvmRoute (if present) from the given id.- Specified by:
setRequestedSessionId
in interfaceHttpRequest
- 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.- Specified by:
setRequestedSessionURL
in interfaceHttpRequest
- Parameters:
flag
- The new flag
-
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. Used by FBL when restoring original request after successful authentication.- Specified by:
setRequestURI
in interfaceHttpRequest
- Parameters:
uri
- The request URI
-
getDecodedRequestURI
public String getDecodedRequestURI()
Get the decoded request URI.- Specified by:
getDecodedRequestURI
in interfaceHttpRequest
- Returns:
- the URL decoded request URI
-
getDecodedRequestURI
public String getDecodedRequestURI(boolean maskDefaultContextMapping)
Gets the decoded request URI.- Parameters:
maskDefaultContextMapping
- true if the fact that a request received at the root context was mapped to a default-web-module will be masked, false otherwise
-
setServletPath
public void setServletPath(String servletPath)
Sets the servlet path for this Request.- Specified by:
setServletPath
in interfaceHttpRequest
- Parameters:
servletPath
- The servlet path
-
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 thegetRemoteUser()
method.- Specified by:
setUserPrincipal
in interfaceHttpRequest
- Parameters:
principal
- The user Principal
-
getAuthType
public String getAuthType()
Return the authentication type used for this Request.- Specified by:
getAuthType
in interfacejakarta.servlet.http.HttpServletRequest
-
getContextPath
public String getContextPath()
Return the portion of the request URI used to select the Context of the Request.- Specified by:
getContextPath
in interfacejakarta.servlet.http.HttpServletRequest
-
getContextPath
public String getContextPath(boolean maskDefaultContextMapping)
Gets the portion of the request URI used to select the Context of the Request.- Parameters:
maskDefaultContextMapping
- true if the fact that a request received at the root context was mapped to a default-web-module will be masked, false otherwise
-
getCookies
public jakarta.servlet.http.Cookie[] getCookies()
Return the set of Cookies received with this Request.- Specified by:
getCookies
in interfacejakarta.servlet.http.HttpServletRequest
-
setCookies
public void setCookies(jakarta.servlet.http.Cookie[] cookies)
Set the set of cookies received with this Request.
-
getDateHeader
public long getDateHeader(String name)
Return the value of the specified date header, if any; otherwise return -1.- Specified by:
getDateHeader
in interfacejakarta.servlet.http.HttpServletRequest
- 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, returnnull
- Specified by:
getHeader
in interfacejakarta.servlet.http.HttpServletRequest
- Parameters:
name
- Name of the requested header
-
getHeaders
public Enumeration<String> getHeaders(String name)
Return all of the values of the specified header, if any; otherwise, return an empty enumeration.- Specified by:
getHeaders
in interfacejakarta.servlet.http.HttpServletRequest
- Parameters:
name
- Name of the requested header
-
getHeaderNames
public Enumeration<String> getHeaderNames()
Return the names of all headers received with this request.- Specified by:
getHeaderNames
in interfacejakarta.servlet.http.HttpServletRequest
-
getIntHeader
public int getIntHeader(String headerName)
Return the value of the specified header as an integer, or -1 if there is no such header for this request.- Specified by:
getIntHeader
in interfacejakarta.servlet.http.HttpServletRequest
- Parameters:
headerName
- Name of the requested header- Throws:
IllegalArgumentException
- if the specified header value cannot be converted to an integer
-
getTrailerFields
public Map<String,String> getTrailerFields()
- Specified by:
getTrailerFields
in interfacejakarta.servlet.http.HttpServletRequest
-
isTrailerFieldsReady
public boolean isTrailerFieldsReady()
- Specified by:
isTrailerFieldsReady
in interfacejakarta.servlet.http.HttpServletRequest
-
getMethod
public String getMethod()
Return the HTTP request method used in this Request.- Specified by:
getMethod
in interfacejakarta.servlet.http.HttpServletRequest
-
getPathInfo
public String getPathInfo()
Return the path information associated with this Request.- Specified by:
getPathInfo
in interfacejakarta.servlet.http.HttpServletRequest
-
getPathTranslated
public String getPathTranslated()
Return the extra path information for this request, translated to a real path.- Specified by:
getPathTranslated
in interfacejakarta.servlet.http.HttpServletRequest
-
newPushBuilder
public jakarta.servlet.http.PushBuilder newPushBuilder()
- Specified by:
newPushBuilder
in interfacejakarta.servlet.http.HttpServletRequest
-
getQueryString
public String getQueryString()
Return the query string associated with this request.- Specified by:
getQueryString
in interfacejakarta.servlet.http.HttpServletRequest
-
getRemoteUser
public String getRemoteUser()
Return the name of the remote user that has been authenticated for this Request.- Specified by:
getRemoteUser
in interfacejakarta.servlet.http.HttpServletRequest
-
getRequestPathMB
public org.glassfish.grizzly.http.util.DataChunk getRequestPathMB()
Get the request path.- Specified by:
getRequestPathMB
in interfaceHttpRequest
- Returns:
- the request path
-
getRequestedSessionId
public String getRequestedSessionId()
Return the session identifier included in this request, if any.- Specified by:
getRequestedSessionId
in interfacejakarta.servlet.http.HttpServletRequest
-
getRequestURI
public String getRequestURI()
Return the request URI for this request.- Specified by:
getRequestURI
in interfacejakarta.servlet.http.HttpServletRequest
-
getRequestURI
public String getRequestURI(boolean maskDefaultContextMapping)
Gets the request URI for this request.- Parameters:
maskDefaultContextMapping
- true if the fact that a request received at the root context was mapped to a default-web-module will be masked, false otherwise
-
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
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.
- Specified by:
getRequestURL
in interfacejakarta.servlet.http.HttpServletRequest
- Returns:
- A
StringBuilder
object containing the reconstructed URL
-
getRequestURL
public StringBuffer getRequestURL(boolean maskDefaultContextMapping)
-
getServletPath
public String getServletPath()
Return the portion of the request URI used to select the servlet that will process this request.- Specified by:
getServletPath
in interfacejakarta.servlet.http.HttpServletRequest
-
getSession
public jakarta.servlet.http.HttpSession getSession()
Return the session associated with this Request, creating one if necessary.- Specified by:
getSession
in interfacejakarta.servlet.http.HttpServletRequest
-
getSession
public jakarta.servlet.http.HttpSession getSession(boolean create)
Return the session associated with this Request, creating one if necessary and requested.- Specified by:
getSession
in interfacejakarta.servlet.http.HttpServletRequest
- Parameters:
create
- Create a new session if one does not exist
-
setSession
public void setSession(Session newSess)
set the session - this method is not for general use- Parameters:
newSess
- the new session
-
isRequestedSessionIdFromCookie
public boolean isRequestedSessionIdFromCookie()
Returntrue
if the session identifier included in this request came from a cookie.- Specified by:
isRequestedSessionIdFromCookie
in interfacejakarta.servlet.http.HttpServletRequest
-
isRequestedSessionIdFromURL
public boolean isRequestedSessionIdFromURL()
Returntrue
if the session identifier included in this request came from the request URI.- Specified by:
isRequestedSessionIdFromURL
in interfacejakarta.servlet.http.HttpServletRequest
-
isRequestedSessionIdFromUrl
public boolean isRequestedSessionIdFromUrl()
Deprecated.As of Version 2.1 of the Java Servlet API, useisRequestedSessionIdFromURL()
instead.Returntrue
if the session identifier included in this request came from the request URI.- Specified by:
isRequestedSessionIdFromUrl
in interfacejakarta.servlet.http.HttpServletRequest
-
setRequestedSessionIdFromSecureCookie
public void setRequestedSessionIdFromSecureCookie(boolean secure)
Marks (or unmarks) this request as having a JSESSIONID cookie that is marked as secure- Parameters:
secure
- true if this request has a JSESSIONID cookie that is marked as secure, false otherwise
-
isRequestedSessionIdFromSecureCookie
public boolean isRequestedSessionIdFromSecureCookie()
- Returns:
- true if this request contains a JSESSIONID cookie that is marked as secure, false otherwise
-
isRequestedSessionIdValid
public boolean isRequestedSessionIdValid()
Returntrue
if the session identifier included in this request identifies a valid session.- Specified by:
isRequestedSessionIdValid
in interfacejakarta.servlet.http.HttpServletRequest
-
isUserInRole
public boolean isUserInRole(String role)
Returntrue
if the authenticated user principal possesses the specified role name.- Specified by:
isUserInRole
in interfacejakarta.servlet.http.HttpServletRequest
- Parameters:
role
- Role name to be validated
-
getUserPrincipal
public Principal getUserPrincipal()
Return the principal that has been authenticated for this Request.- Specified by:
getUserPrincipal
in interfacejakarta.servlet.http.HttpServletRequest
-
getSessionInternal
public Session getSessionInternal()
Return the session associated with this Request, creating one if necessary.
-
getSessionInternal
public Session getSessionInternal(boolean create)
Gets the session associated with this Request, creating one if necessary and requested.- Specified by:
getSessionInternal
in interfaceRequest
- Parameters:
create
- true if a new session is to be created if one does not already exist, false otherwise
-
changeSessionId
public String changeSessionId()
Change the session id of the current session associated with this request and return the new session id.- Specified by:
changeSessionId
in interfacejakarta.servlet.http.HttpServletRequest
- Specified by:
changeSessionId
in interfaceRequest
- Returns:
- the new session id
- Throws:
IllegalStateException
- if there is no session associated with the request- Since:
- Servlet 3.1
-
generateSessionId
public String generateSessionId()
This object does not implement a session ID generator. Provide a dummy implementation so that the default one will be used.- Specified by:
generateSessionId
in interfaceRequest
-
getServletContext
public jakarta.servlet.ServletContext getServletContext()
Gets the servlet context to which this servlet request was last dispatched.- Specified by:
getServletContext
in interfacejakarta.servlet.ServletRequest
- Returns:
- the servlet context to which this servlet request was last dispatched
-
upgrade
public <T extends jakarta.servlet.http.HttpUpgradeHandler> T upgrade(Class<T> handlerClass) throws IOException, jakarta.servlet.ServletException
Create an instance ofHttpUpgradeHandler
for an given class and uses it for the http protocol upgrade processing.- Specified by:
upgrade
in interfacejakarta.servlet.http.HttpServletRequest
- Parameters:
handlerClass
- TheHttpUpgradeHandler
class used for the upgrade.- Returns:
- an instance of the
HttpUpgradeHandler
- Throws:
IOException
- if an I/O error occurred during the upgradejakarta.servlet.ServletException
- if the given clazz fails to be instantiated- Since:
- Servlet 3.1
- See Also:
HttpUpgradeHandler
,WebConnection
-
initialiseHttpUpgradeHandler
public void initialiseHttpUpgradeHandler(jakarta.servlet.http.WebConnection wc)
-
getWebConnection
public jakarta.servlet.http.WebConnection getWebConnection()
-
setWebConnection
public void setWebConnection(jakarta.servlet.http.WebConnection wc)
-
doGetSession
protected Session doGetSession(boolean create)
-
configureSessionCookie
protected void configureSessionCookie(jakarta.servlet.http.Cookie cookie)
Configures the given JSESSIONID cookie.- Parameters:
cookie
- The JSESSIONID cookie to be configured
-
parseCookies
protected void parseCookies()
Parse cookies.
-
makeCookie
protected jakarta.servlet.http.Cookie makeCookie(org.glassfish.grizzly.http.Cookie scookie)
-
makeCookie
protected jakarta.servlet.http.Cookie makeCookie(org.glassfish.grizzly.http.Cookie scookie, boolean decode)
-
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
-
isAlpha
protected static boolean isAlpha(String value)
-
obtainSessionId
protected void obtainSessionId()
Take the session id from Grizzly Request
-
parseSessionId
protected void parseSessionId(String sessionParameterName, org.glassfish.grizzly.http.util.CharChunk uriBB)
Parse session id in URL.
-
parseSessionVersion
protected void parseSessionVersion(org.glassfish.grizzly.http.util.CharChunk uriCC)
Parses and removes any session version (if present) from the request URI.
-
parseJReplica
protected void parseJReplica(org.glassfish.grizzly.http.util.CharChunk uriCC)
Parses and removes jreplica (if present) from the request URI.
-
getJrouteId
public String getJrouteId()
Gets the jroute id of this request, which may have been sent as a separateJROUTE
cookie or appended to the session identifier encoded in the URI (if cookies have been disabled).- Specified by:
getJrouteId
in interfaceRequest
- Returns:
- The jroute id of this request, or null if this request does not carry any jroute id
-
parseSessionCookiesId
protected void parseSessionCookiesId()
Parse session id in URL.
-
convertURI
protected void convertURI(org.glassfish.grizzly.http.util.MessageBytes uri) throws Exception
Character conversion of the URI.- Throws:
Exception
-
getDispatcherType
public jakarta.servlet.DispatcherType getDispatcherType()
- Specified by:
getDispatcherType
in interfacejakarta.servlet.ServletRequest
-
startAsync
public jakarta.servlet.AsyncContext startAsync() throws IllegalStateException
Starts async processing on this request.- Specified by:
startAsync
in interfacejakarta.servlet.ServletRequest
- Throws:
IllegalStateException
-
startAsync
public jakarta.servlet.AsyncContext startAsync(jakarta.servlet.ServletRequest servletRequest, jakarta.servlet.ServletResponse servletResponse) throws IllegalStateException
Starts async processing on this request.- Specified by:
startAsync
in interfacejakarta.servlet.ServletRequest
- Parameters:
servletRequest
- the ServletRequest with which to initialize the AsyncContextservletResponse
- the ServletResponse with which to initialize the AsyncContext- Throws:
IllegalStateException
-
isAsyncStarted
public boolean isAsyncStarted()
Checks whether async processing has started on this request.- Specified by:
isAsyncStarted
in interfacejakarta.servlet.ServletRequest
-
disableAsyncSupport
public void disableAsyncSupport()
Disables async support for this request. Async support is disabled as soon as this request has passed a filter or servlet that does not support async (either via the designated annotation or declaratively).- Specified by:
disableAsyncSupport
in interfaceRequest
-
isAsyncSupported
public boolean isAsyncSupported()
Checks whether this request supports async.- Specified by:
isAsyncSupported
in interfacejakarta.servlet.ServletRequest
-
getAsyncContext
public jakarta.servlet.AsyncContext getAsyncContext()
Gets the AsyncContext of this request.- Specified by:
getAsyncContext
in interfacejakarta.servlet.ServletRequest
-
getParts
public Collection<jakarta.servlet.http.Part> getParts() throws IOException, jakarta.servlet.ServletException
- Specified by:
getParts
in interfacejakarta.servlet.http.HttpServletRequest
- Throws:
IOException
jakarta.servlet.ServletException
-
getPart
public jakarta.servlet.http.Part getPart(String name) throws IOException, jakarta.servlet.ServletException
- Specified by:
getPart
in interfacejakarta.servlet.http.HttpServletRequest
- Throws:
IOException
jakarta.servlet.ServletException
-
lockSession
public Session lockSession()
lock the session associated with this request this will be a foreground lock checks for background lock to clear and does a decay poll loop to wait until it is clear; after 5 times it takes control for the foreground- Specified by:
lockSession
in interfaceRequest
- Returns:
- the session that's been locked
-
unlockSession
public void unlockSession()
unlock the session associated with this request- Specified by:
unlockSession
in interfaceRequest
-
-