Package org.glassfish.grizzly.servlet
Class DispatchedHttpServletRequest
java.lang.Object
jakarta.servlet.ServletRequestWrapper
jakarta.servlet.http.HttpServletRequestWrapper
org.glassfish.grizzly.servlet.DispatchedHttpServletRequest
- All Implemented Interfaces:
HttpServletRequest,ServletRequest
Wrapper around a
jakarta.servlet.http.HttpServletRequest that transforms an application request object
(which might be the original one passed to a servlet.- Author:
- Bongjae Chang
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected WebappContextThe context for this request.protected StringThe context path for this request.protected booleanIf this request is cross context, since this changes session access behavior.protected final DispatcherTypeThe dispatcher type.protected StringThe path information for this request.protected StringThe query string for this request.protected ObjectThe current request dispatcher path.protected StringThe request URI for this request.protected StringThe servlet path for this request.Fields inherited from interface jakarta.servlet.http.HttpServletRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH -
Constructor Summary
ConstructorsConstructorDescriptionDispatchedHttpServletRequest(HttpServletRequest request, WebappContext context, boolean crossContext, DispatcherType dispatcherType) Construct a new wrapped request around the specified servlet request. -
Method Summary
Modifier and TypeMethodDescriptiongetAttribute(String name) Override thegetAttribute()method of the wrapped request.Override thegetAttributeNames()method of the wrapped request.Override thegetContextPath()method of the wrapped request.Gets the dispatcher type of the wrapped request.getParameter(String name) Override thegetParameter()method of the wrapped request.Override thegetParameterMap()method of the wrapped request.Override thegetParameterNames()method of the wrapped request.String[]getParameterValues(String name) Override thegetParameterValues()method of the wrapped request.Override thegetPathInfo()method of the wrapped request.Override thegetQueryString()method of the wrapped request.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.Override thegetRequestURI()method of the wrapped request.Override thegetRequestURL()method of the wrapped request.Override thegetServletPath()method of the wrapped request.protected booleanIs this attribute name one of the special ones that is added only for included servlets?protected String[]mergeValues(Object values1, Object values2) Merge the two sets of parameter values into a single String array.voidrecycle()voidremoveAttribute(String name) Override theremoveAttribute()method of the wrapped request.voidsetAttribute(String name, Object value) Override thesetAttribute()method of the wrapped request.Methods inherited from class jakarta.servlet.http.HttpServletRequestWrapper
authenticate, changeSessionId, getAuthType, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getHttpServletMapping, getIntHeader, getMethod, getPart, getParts, getPathTranslated, getRemoteUser, getRequestedSessionId, getSession, getSession, getTrailerFields, getUserPrincipal, isRequestedSessionIdFromCookie, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isTrailerFieldsReady, isUserInRole, login, logout, newPushBuilder, upgradeMethods inherited from class jakarta.servlet.ServletRequestWrapper
getAsyncContext, getCharacterEncoding, getContentLength, getContentLengthLong, getContentType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getProtocol, getProtocolRequestId, getReader, getRemoteAddr, getRemoteHost, getRemotePort, getRequest, getRequestId, getScheme, getServerName, getServerPort, getServletConnection, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, isWrapperFor, isWrapperFor, setCharacterEncoding, setRequest, startAsync, startAsyncMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface jakarta.servlet.ServletRequest
getAsyncContext, getCharacterEncoding, getContentLength, getContentLengthLong, getContentType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getProtocol, getProtocolRequestId, getReader, getRemoteAddr, getRemoteHost, getRemotePort, getRequestId, getScheme, getServerName, getServerPort, getServletConnection, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, setCharacterEncoding, startAsync, startAsync
-
Field Details
-
context
The context for this request. -
contextPath
The context path for this request. -
crossContext
protected boolean crossContextIf this request is cross context, since this changes session access behavior. -
dispatcherType
The dispatcher type. -
pathInfo
The path information for this request. -
queryString
The query string for this request. -
requestDispatcherPath
The current request dispatcher path. -
requestURI
The request URI for this request. -
servletPath
The servlet path for this request.
-
-
Constructor Details
-
DispatchedHttpServletRequest
public DispatchedHttpServletRequest(HttpServletRequest request, WebappContext context, boolean crossContext, DispatcherType dispatcherType) Construct a new wrapped request around the specified servlet request.- Parameters:
request- the servlet request being wrappeddispatcherType- the dispatcher type
-
-
Method Details
-
getAttribute
Override thegetAttribute()method of the wrapped request.- Specified by:
getAttributein interfaceServletRequest- Overrides:
getAttributein classServletRequestWrapper- Parameters:
name- Name of the attribute to retrieve- Returns:
- an
Objectcontaining the value of the attribute, ornullif the attribute does not exist
-
getAttributeNames
Override thegetAttributeNames()method of the wrapped request.- Specified by:
getAttributeNamesin interfaceServletRequest- Overrides:
getAttributeNamesin classServletRequestWrapper- Returns:
- an
Enumerationof strings containing the names of the request's attributes
-
removeAttribute
Override theremoveAttribute()method of the wrapped request.- Specified by:
removeAttributein interfaceServletRequest- Overrides:
removeAttributein classServletRequestWrapper- Parameters:
name- Name of the attribute to remove
-
setAttribute
Override thesetAttribute()method of the wrapped request.- Specified by:
setAttributein interfaceServletRequest- Overrides:
setAttributein classServletRequestWrapper- Parameters:
name- Name of the attribute to setvalue- Value of the attribute to set
-
getRequestDispatcher
Return a RequestDispatcher that wraps the resource at the specified path, which may be interpreted as relative to the current request path.- Specified by:
getRequestDispatcherin interfaceServletRequest- Overrides:
getRequestDispatcherin classServletRequestWrapper- Parameters:
path- Path of the resource to be wrapped- Returns:
- a
RequestDispatcherobject that acts as a wrapper for the resource at the specified path, ornullif the servlet container cannot return aRequestDispatcher - See Also:
-
getDispatcherType
Description copied from class:ServletRequestWrapperGets the dispatcher type of the wrapped request.- Specified by:
getDispatcherTypein interfaceServletRequest- Overrides:
getDispatcherTypein classServletRequestWrapper- Returns:
- the dispatcher type of the wrapped request
- See Also:
-
getContextPath
Override thegetContextPath()method of the wrapped request.- Specified by:
getContextPathin interfaceHttpServletRequest- Overrides:
getContextPathin classHttpServletRequestWrapper- Returns:
- a
Stringspecifying the portion of the request URI that indicates the context of the request. The path will be canonicalized as per section 3.5 of the specification. This method will not return any encoded characters unless the container is configured specifically to allow them. - See Also:
-
getParameter
Override thegetParameter()method of the wrapped request.- Specified by:
getParameterin interfaceServletRequest- Overrides:
getParameterin classServletRequestWrapper- Parameters:
name- Name of the requested parameter- Returns:
- a
Stringrepresenting the single value of the parameter - See Also:
-
getParameterMap
Override thegetParameterMap()method of the wrapped request.- Specified by:
getParameterMapin interfaceServletRequest- Overrides:
getParameterMapin classServletRequestWrapper- Returns:
- an immutable java.util.Map containing parameter names as keys and parameter values as map values. The keys in the parameter map are of type String. The values in the parameter map are of type String array.
-
getParameterNames
Override thegetParameterNames()method of the wrapped request.- Specified by:
getParameterNamesin interfaceServletRequest- Overrides:
getParameterNamesin classServletRequestWrapper- Returns:
- an
EnumerationofStringobjects, eachStringcontaining the name of a request parameter; or an emptyEnumerationif the request has no parameters
-
getParameterValues
Override thegetParameterValues()method of the wrapped request.- Specified by:
getParameterValuesin interfaceServletRequest- Overrides:
getParameterValuesin classServletRequestWrapper- Parameters:
name- Name of the requested parameter- Returns:
- an array of
Stringobjects containing the parameter's values - See Also:
-
getPathInfo
Override thegetPathInfo()method of the wrapped request.- Specified by:
getPathInfoin interfaceHttpServletRequest- Overrides:
getPathInfoin classHttpServletRequestWrapper- Returns:
- a
Stringspecifying extra path information that comes after the servlet path but before the query string in the request URL; ornullif the URL does not have any extra path information. The path will be canonicalized as per section 3.5 of the specification. This method will not return any encoded characters unless the container is configured specifically to allow them.
-
getQueryString
Override thegetQueryString()method of the wrapped request.- Specified by:
getQueryStringin interfaceHttpServletRequest- Overrides:
getQueryStringin classHttpServletRequestWrapper- Returns:
- a
Stringcontaining the query string ornullif the URL contains no query string. The value is not decoded by the container.
-
getRequestURI
Override thegetRequestURI()method of the wrapped request.- Specified by:
getRequestURIin interfaceHttpServletRequest- Overrides:
getRequestURIin classHttpServletRequestWrapper- Returns:
- a
Stringcontaining the part of the URL from the protocol name up to the query string
-
getRequestURL
Override thegetRequestURL()method of the wrapped request.- Specified by:
getRequestURLin interfaceHttpServletRequest- Overrides:
getRequestURLin classHttpServletRequestWrapper- Returns:
- a
StringBufferobject containing the reconstructed URL
-
getServletPath
Override thegetServletPath()method of the wrapped request.- Specified by:
getServletPathin interfaceHttpServletRequest- Overrides:
getServletPathin classHttpServletRequestWrapper- Returns:
- a
Stringcontaining the path of the servlet being called, as specified in the request URL, or an empty string if the servlet used to process the request is matched using the "/*" pattern. The path will be canonicalized as per section 3.5 of the specification. This method will not return any encoded characters unless the container is configured specifically to allow them.
-
isSpecial
Is this attribute name one of the special ones that is added only for included servlets?- Parameters:
name- Attribute name to be tested
-
mergeValues
Merge the two sets of parameter values into a single String array.- Parameters:
values1- First set of valuesvalues2- Second set of values
-
recycle
public void recycle() -
getRequestFacade
-