Top Description Inners Fields Constructors Methods
org.glassfish.grizzly.servlet

public Class DispatchedHttpServletRequest

extends HttpServletRequestWrapper
Class Inheritance
Imports
java.nio.charset.Charset, java.security.AccessController, .PrivilegedAction, java.util.ArrayList, .Collections, .Enumeration, .HashMap, .HashSet, .Iterator, .Map, .NoSuchElementException, .Set, org.glassfish.grizzly.http.server.util.Enumerator, .Globals, .ParameterMap, org.glassfish.grizzly.http.util.Constants, .DataChunk, .Parameters, org.glassfish.grizzly.utils.Charsets, jakarta.servlet.AsyncContext, .DispatcherType, .RequestDispatcher, jakarta.servlet.http.HttpServletRequest, .HttpServletRequestWrapper

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

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
DispatchedHttpServletRequest.AttributeNamesEnumerator

Utility class used to expose the special attributes as being available as request attributes.

private class
private class
private class
private class

Field Summary

Modifier and TypeField and Description
protected WebappContext
context

The context for this request.

protected String
contextPath

The context path for this request.

protected boolean
crossContext

If this request is cross context, since this changes session access behavior.

protected final DispatcherType
dispatcherType

The dispatcher type.

private final Parameters
private final ParameterMap
parameterMap

Hash map used in the getParametersMap method.

private boolean
parsedParams

Have the parameters for this request already been parsed?

protected String
pathInfo

The path information for this request.

private String
queryParamString

The query parameters for the current request.

protected String
queryString

The query string for this request.

protected Object
requestDispatcherPath

The current request dispatcher path.

protected String
requestURI

The request URI for this request.

protected String
servletPath

The servlet path for this request.

private HashMap<String, Object>
specialAttributes

Special attributes.

private static final HashSet<String>
specials

The set of attribute names that are special for request dispatchers

Constructor Summary

AccessConstructor and Description
public
DispatchedHttpServletRequest(HttpServletRequest
the servlet request being wrapped
request
,
WebappContext context, boolean crossContext, DispatcherType
the dispatcher type
dispatcherType
)

Construct a new wrapped request around the specified servlet request.

Method Summary

Modifier and TypeMethod and Description
pack-priv void
copyMap(Map<String, String[]>
Origin Map to be copied
orig
,
Map<String, String[]> dest)

Perform a shallow copy of the specified Map, and return the result.

public Object
getAttribute(String
Name of the attribute to retrieve
name
)

Overrides jakarta.servlet.ServletRequestWrapper.getAttribute.

Implements jakarta.servlet.ServletRequest.getAttribute.

Override the getAttribute() method of the wrapped request.

public Enumeration<String>
getAttributeNames()

Overrides jakarta.servlet.ServletRequestWrapper.getAttributeNames.

Implements jakarta.servlet.ServletRequest.getAttributeNames.

Override the getAttributeNames() method of the wrapped request.

public String
getContextPath()

Overrides jakarta.servlet.http.HttpServletRequestWrapper.getContextPath.

Implements jakarta.servlet.http.HttpServletRequest.getContextPath.

Override the getContextPath() method of the wrapped request.

public DispatcherType
public String
getParameter(String
Name of the requested parameter
name
)

Overrides jakarta.servlet.ServletRequestWrapper.getParameter.

Implements jakarta.servlet.ServletRequest.getParameter.

Override the getParameter() method of the wrapped request.

public Map<String, String[]>
getParameterMap()

Overrides jakarta.servlet.ServletRequestWrapper.getParameterMap.

Implements jakarta.servlet.ServletRequest.getParameterMap.

Override the getParameterMap() method of the wrapped request.

private ParameterMap
public Enumeration<String>
getParameterNames()

Overrides jakarta.servlet.ServletRequestWrapper.getParameterNames.

Implements jakarta.servlet.ServletRequest.getParameterNames.

Override the getParameterNames() method of the wrapped request.

public String[]
getParameterValues(String
Name of the requested parameter
name
)

Overrides jakarta.servlet.ServletRequestWrapper.getParameterValues.

Implements jakarta.servlet.ServletRequest.getParameterValues.

Override the getParameterValues() method of the wrapped request.

public String
getPathInfo()

Overrides jakarta.servlet.http.HttpServletRequestWrapper.getPathInfo.

Implements jakarta.servlet.http.HttpServletRequest.getPathInfo.

Override the getPathInfo() method of the wrapped request.

public String
getQueryString()

Overrides jakarta.servlet.http.HttpServletRequestWrapper.getQueryString.

Implements jakarta.servlet.http.HttpServletRequest.getQueryString.

Override the getQueryString() method of the wrapped request.

public RequestDispatcher
getRequestDispatcher(String
Path of the resource to be wrapped
path
)

Overrides jakarta.servlet.ServletRequestWrapper.getRequestDispatcher.

Implements jakarta.servlet.ServletRequest.getRequestDispatcher.

Return a RequestDispatcher that wraps the resource at the specified path, which may be interpreted as relative to the current request path.

public HttpServletRequestImpl
public String
getRequestURI()

Overrides jakarta.servlet.http.HttpServletRequestWrapper.getRequestURI.

Implements jakarta.servlet.http.HttpServletRequest.getRequestURI.

Override the getRequestURI() method of the wrapped request.

public StringBuffer
getRequestURL()

Overrides jakarta.servlet.http.HttpServletRequestWrapper.getRequestURL.

Implements jakarta.servlet.http.HttpServletRequest.getRequestURL.

Override the getRequestURL() method of the wrapped request.

public String
getServletPath()

Overrides jakarta.servlet.http.HttpServletRequestWrapper.getServletPath.

Implements jakarta.servlet.http.HttpServletRequest.getServletPath.

Override the getServletPath() method of the wrapped request.

pack-priv void
initSpecialAttributes(String
The request URI
requestUri
,
String
The context path
contextPath
,
String
The servlet path
servletPath
,
String
The path info
pathInfo
,
String
The query string
queryString
)

Initializes the special attributes of this request wrapper.

protected boolean
isSpecial(String
Attribute name to be tested
name
)

Is this attribute name one of the special ones that is added only for included servlets?

protected String[]
mergeValues(Object
First set of values
values1
,
Object
Second set of values
values2
)

Merge the two sets of parameter values into a single String array.

private void
parseParameters()

Parses the parameters of this request.

public void
public void
removeAttribute(String
Name of the attribute to remove
name
)

Overrides jakarta.servlet.ServletRequestWrapper.removeAttribute.

Implements jakarta.servlet.ServletRequest.removeAttribute.

Override the removeAttribute() method of the wrapped request.

public void
setAttribute(String
Name of the attribute to set
name
,
Object
Value of the attribute to set
value
)

Overrides jakarta.servlet.ServletRequestWrapper.setAttribute.

Implements jakarta.servlet.ServletRequest.setAttribute.

Override the setAttribute() method of the wrapped request.

pack-priv void
setContextPath(String
The new context path
contextPath
)

Set the context path for this request.

pack-priv void
setPathInfo(String
The new path info
pathInfo
)

Set the path information for this request.

pack-priv void
setQueryParams(String
The query string containing parameters for this request
queryString
)

Save query parameters for this request.

pack-priv void
setQueryString(String
The new query string
queryString
)

Set the query string for this request.

pack-priv void
setRequest(HttpServletRequest
The new wrapped request
request
)

Set the request that we are wrapping.

pack-priv void
setRequestURI(String
The new request URI
requestURI
)

Set the request URI for this request.

pack-priv void
setServletPath(String
The new servlet path
servletPath
)

Set the servlet path for this request.

Inherited from jakarta.servlet.http.HttpServletRequestWrapper:
authenticatechangeSessionIdgetAuthTypegetCookiesgetDateHeadergetHeadergetHeaderNamesgetHeadersgetHttpServletMappinggetIntHeadergetMethodgetPartgetPartsgetPathTranslatedgetRemoteUsergetRequestedSessionIdgetSessiongetSessiongetTrailerFieldsgetUserPrincipalisRequestedSessionIdFromCookieisRequestedSessionIdFromURLisRequestedSessionIdValidisTrailerFieldsReadyisUserInRoleloginlogoutnewPushBuilderupgrade

Field Detail

contextback to summary
protected WebappContext context

The context for this request.

contextPathback to summary
protected String contextPath

The context path for this request.

crossContextback to summary
protected boolean crossContext

If this request is cross context, since this changes session access behavior.

dispatcherTypeback to summary
protected final DispatcherType dispatcherType

The dispatcher type.

mergedParametersback to summary
private final Parameters mergedParameters
parameterMapback to summary
private final ParameterMap parameterMap

Hash map used in the getParametersMap method.

parsedParamsback to summary
private boolean parsedParams

Have the parameters for this request already been parsed?

pathInfoback to summary
protected String pathInfo

The path information for this request.

queryParamStringback to summary
private String queryParamString

The query parameters for the current request.

queryStringback to summary
protected String queryString

The query string for this request.

requestDispatcherPathback to summary
protected Object requestDispatcherPath

The current request dispatcher path.

requestURIback to summary
protected String requestURI

The request URI for this request.

servletPathback to summary
protected String servletPath

The servlet path for this request.

specialAttributesback to summary
private HashMap<String, Object> specialAttributes

Special attributes.

specialsback to summary
private static final HashSet<String> specials

The set of attribute names that are special for request dispatchers

Constructor Detail

DispatchedHttpServletRequestback to summary
public DispatchedHttpServletRequest(HttpServletRequest request, WebappContext context, boolean crossContext, DispatcherType dispatcherType)

Construct a new wrapped request around the specified servlet request.

Parameters
request:HttpServletRequest

the servlet request being wrapped

dispatcherType:DispatcherType

the dispatcher type

Method Detail

copyMapback to summary
pack-priv void copyMap(Map<String, String[]> orig, Map<String, String[]> dest)

Perform a shallow copy of the specified Map, and return the result.

Parameters
orig:Map<String, String[]>

Origin Map to be copied

getAttributeback to summary
public Object getAttribute(String name)

Overrides jakarta.servlet.ServletRequestWrapper.getAttribute.

Implements jakarta.servlet.ServletRequest.getAttribute.

Override the getAttribute() method of the wrapped request.

Parameters
name:String

Name of the attribute to retrieve

Annotations
@Override
getAttributeNamesback to summary
public Enumeration<String> getAttributeNames()

Overrides jakarta.servlet.ServletRequestWrapper.getAttributeNames.

Implements jakarta.servlet.ServletRequest.getAttributeNames.

Override the getAttributeNames() method of the wrapped request.

Annotations
@Override
getContextPathback to summary
public String getContextPath()

Overrides jakarta.servlet.http.HttpServletRequestWrapper.getContextPath.

Implements jakarta.servlet.http.HttpServletRequest.getContextPath.

Override the getContextPath() method of the wrapped request.

Annotations
@Override
getDispatcherTypeback to summary
public DispatcherType getDispatcherType()

Overrides jakarta.servlet.ServletRequestWrapper.getDispatcherType.

Implements jakarta.servlet.ServletRequest.getDispatcherType.

Doc from jakarta.servlet.ServletRequest.getDispatcherType.

Gets the dispatcher type of this request.

The dispatcher type of a request is used by the container to select the filters that need to be applied to the request: Only filters with matching dispatcher type and url patterns will be applied.

Allowing a filter that has been configured for multiple dispatcher types to query a request for its dispatcher type allows the filter to process the request differently depending on its dispatcher type.

The initial dispatcher type of a request is defined as DispatcherType.REQUEST. The dispatcher type of a request dispatched via RequestDispatcher#forward(ServletRequest, ServletResponse) or RequestDispatcher#include(ServletRequest, ServletResponse) is given as DispatcherType.FORWARD or DispatcherType.INCLUDE, respectively, while the dispatcher type of an asynchronous request dispatched via one of the AsyncContext#dispatch methods is given as DispatcherType.ASYNC. Finally, the dispatcher type of a request dispatched to an error page by the container's error handling mechanism is given as DispatcherType.ERROR.

Annotations
@Override
getParameterback to summary
public String getParameter(String name)

Overrides jakarta.servlet.ServletRequestWrapper.getParameter.

Implements jakarta.servlet.ServletRequest.getParameter.

Override the getParameter() method of the wrapped request.

Parameters
name:String

Name of the requested parameter

Annotations
@Override
getParameterMapback to summary
public Map<String, String[]> getParameterMap()

Overrides jakarta.servlet.ServletRequestWrapper.getParameterMap.

Implements jakarta.servlet.ServletRequest.getParameterMap.

Override the getParameterMap() method of the wrapped request.

Annotations
@Override
getParameterMapInternalback to summary
private ParameterMap getParameterMapInternal()
getParameterNamesback to summary
public Enumeration<String> getParameterNames()

Overrides jakarta.servlet.ServletRequestWrapper.getParameterNames.

Implements jakarta.servlet.ServletRequest.getParameterNames.

Override the getParameterNames() method of the wrapped request.

Annotations
@Override
getParameterValuesback to summary
public String[] getParameterValues(String name)

Overrides jakarta.servlet.ServletRequestWrapper.getParameterValues.

Implements jakarta.servlet.ServletRequest.getParameterValues.

Override the getParameterValues() method of the wrapped request.

Parameters
name:String

Name of the requested parameter

Annotations
@Override
getPathInfoback to summary
public String getPathInfo()

Overrides jakarta.servlet.http.HttpServletRequestWrapper.getPathInfo.

Implements jakarta.servlet.http.HttpServletRequest.getPathInfo.

Override the getPathInfo() method of the wrapped request.

Annotations
@Override
getQueryStringback to summary
public String getQueryString()

Overrides jakarta.servlet.http.HttpServletRequestWrapper.getQueryString.

Implements jakarta.servlet.http.HttpServletRequest.getQueryString.

Override the getQueryString() method of the wrapped request.

Annotations
@Override
getRequestDispatcherback to summary
public RequestDispatcher getRequestDispatcher(String path)

Overrides jakarta.servlet.ServletRequestWrapper.getRequestDispatcher.

Implements jakarta.servlet.ServletRequest.getRequestDispatcher.

Return a RequestDispatcher that wraps the resource at the specified path, which may be interpreted as relative to the current request path.

Parameters
path:String

Path of the resource to be wrapped

Annotations
@Override
getRequestFacadeback to summary
public HttpServletRequestImpl getRequestFacade()
getRequestURIback to summary
public String getRequestURI()

Overrides jakarta.servlet.http.HttpServletRequestWrapper.getRequestURI.

Implements jakarta.servlet.http.HttpServletRequest.getRequestURI.

Override the getRequestURI() method of the wrapped request.

Annotations
@Override
getRequestURLback to summary
public StringBuffer getRequestURL()

Overrides jakarta.servlet.http.HttpServletRequestWrapper.getRequestURL.

Implements jakarta.servlet.http.HttpServletRequest.getRequestURL.

Override the getRequestURL() method of the wrapped request.

Annotations
@Override
getServletPathback to summary
public String getServletPath()

Overrides jakarta.servlet.http.HttpServletRequestWrapper.getServletPath.

Implements jakarta.servlet.http.HttpServletRequest.getServletPath.

Override the getServletPath() method of the wrapped request.

Annotations
@Override
initSpecialAttributesback to summary
pack-priv void initSpecialAttributes(String requestUri, String contextPath, String servletPath, String pathInfo, String queryString)

Initializes the special attributes of this request wrapper.

Parameters
requestUri:String

The request URI

contextPath:String

The context path

servletPath:String

The servlet path

pathInfo:String

The path info

queryString:String

The query string

isSpecialback to summary
protected boolean isSpecial(String name)

Is this attribute name one of the special ones that is added only for included servlets?

Parameters
name:String

Attribute name to be tested

mergeValuesback to summary
protected String[] mergeValues(Object values1, Object values2)

Merge the two sets of parameter values into a single String array.

Parameters
values1:Object

First set of values

values2:Object

Second set of values

parseParametersback to summary
private void parseParameters()

Parses the parameters of this request.

If parameters are present in both the query string and the request content, they are merged.

Annotations
@SuppressWarnings:unchecked
recycleback to summary
public void recycle()
removeAttributeback to summary
public void removeAttribute(String name)

Overrides jakarta.servlet.ServletRequestWrapper.removeAttribute.

Implements jakarta.servlet.ServletRequest.removeAttribute.

Override the removeAttribute() method of the wrapped request.

Parameters
name:String

Name of the attribute to remove

Annotations
@Override
setAttributeback to summary
public void setAttribute(String name, Object value)

Overrides jakarta.servlet.ServletRequestWrapper.setAttribute.

Implements jakarta.servlet.ServletRequest.setAttribute.

Override the setAttribute() method of the wrapped request.

Parameters
name:String

Name of the attribute to set

value:Object

Value of the attribute to set

Annotations
@Override
setContextPathback to summary
pack-priv void setContextPath(String contextPath)

Set the context path for this request.

Parameters
contextPath:String

The new context path

setPathInfoback to summary
pack-priv void setPathInfo(String pathInfo)

Set the path information for this request.

Parameters
pathInfo:String

The new path info

setQueryParamsback to summary
pack-priv void setQueryParams(String queryString)

Save query parameters for this request.

Parameters
queryString:String

The query string containing parameters for this request

setQueryStringback to summary
pack-priv void setQueryString(String queryString)

Set the query string for this request.

Parameters
queryString:String

The new query string

setRequestback to summary
pack-priv void setRequest(HttpServletRequest request)

Set the request that we are wrapping.

Parameters
request:HttpServletRequest

The new wrapped request

setRequestURIback to summary
pack-priv void setRequestURI(String requestURI)

Set the request URI for this request.

Parameters
requestURI:String

The new request URI

setServletPathback to summary
pack-priv void setServletPath(String servletPath)

Set the servlet path for this request.

Parameters
servletPath:String

The new servlet path

org.glassfish.grizzly.servlet back to summary

private final Class DispatchedHttpServletRequest.AttributeNamesEnumerator

extends Object
implements Enumeration<String>
Class Inheritance
  • java.lang.Object
  • org.glassfish.grizzly.servlet.DispatchedHttpServletRequest.AttributeNamesEnumerator
All Implemented Interfaces
java.util.Enumeration

Utility class used to expose the special attributes as being available as request attributes.

Field Summary

Modifier and TypeField and Description
pack-priv String
pack-priv Enumeration<String>
private Iterator<String>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected String
public boolean
hasMoreElements()

Implements java.util.Enumeration.hasMoreElements.

Tests if this enumeration contains more elements.

public String
nextElement()

Implements java.util.Enumeration.nextElement.

Returns the next element of this enumeration if this enumeration object has at least one more element to provide.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

nextback to summary
pack-priv String next
parentEnumerationback to summary
pack-priv Enumeration<String> parentEnumeration
specialNamesback to summary
private Iterator<String> specialNames

Constructor Detail

AttributeNamesEnumeratorback to summary
public AttributeNamesEnumerator()
Annotations
@SuppressWarnings:unchecked

Method Detail

findNextback to summary
protected String findNext()
hasMoreElementsback to summary
public boolean hasMoreElements()

Implements java.util.Enumeration.hasMoreElements.

Doc from java.util.Enumeration.hasMoreElements.

Tests if this enumeration contains more elements.

Annotations
@Override
nextElementback to summary
public String nextElement()

Implements java.util.Enumeration.nextElement.

Doc from java.util.Enumeration.nextElement.

Returns the next element of this enumeration if this enumeration object has at least one more element to provide.

Annotations
@Override
org.glassfish.grizzly.servlet back to summary

private final Class DispatchedHttpServletRequest.GetParameterMapPrivilegedAction

extends Object
implements PrivilegedAction<ParameterMap>
Class Inheritance
  • java.lang.Object
  • org.glassfish.grizzly.servlet.DispatchedHttpServletRequest.GetParameterMapPrivilegedAction
All Implemented Interfaces
java.security.PrivilegedAction

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public ParameterMap
run()

Implements java.security.PrivilegedAction.run.

Performs the computation.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

GetParameterMapPrivilegedActionback to summary
private GetParameterMapPrivilegedAction()

Method Detail

runback to summary
public ParameterMap run()

Implements java.security.PrivilegedAction.run.

Doc from java.security.PrivilegedAction.run.

Performs the computation. This method will be called by AccessController.doPrivileged.

Annotations
@Override
org.glassfish.grizzly.servlet back to summary

private final Class DispatchedHttpServletRequest.GetParameterNamesPrivilegedAction

extends Object
implements PrivilegedAction<Set<String>>
Class Inheritance
  • java.lang.Object
  • org.glassfish.grizzly.servlet.DispatchedHttpServletRequest.GetParameterNamesPrivilegedAction
All Implemented Interfaces
java.security.PrivilegedAction

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public Set<String>
run()

Implements java.security.PrivilegedAction.run.

Performs the computation.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

GetParameterNamesPrivilegedActionback to summary
private GetParameterNamesPrivilegedAction()

Method Detail

runback to summary
public Set<String> run()

Implements java.security.PrivilegedAction.run.

Doc from java.security.PrivilegedAction.run.

Performs the computation. This method will be called by AccessController.doPrivileged.

Annotations
@Override
org.glassfish.grizzly.servlet back to summary

private final Class DispatchedHttpServletRequest.GetParameterPrivilegedAction

extends Object
implements PrivilegedAction<String>
Class Inheritance
  • java.lang.Object
  • org.glassfish.grizzly.servlet.DispatchedHttpServletRequest.GetParameterPrivilegedAction
All Implemented Interfaces
java.security.PrivilegedAction

Field Summary

Modifier and TypeField and Description
public final String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
run()

Implements java.security.PrivilegedAction.run.

Performs the computation.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

nameback to summary
public final String name

Constructor Detail

GetParameterPrivilegedActionback to summary
public GetParameterPrivilegedAction(String name)

Method Detail

runback to summary
public String run()

Implements java.security.PrivilegedAction.run.

Doc from java.security.PrivilegedAction.run.

Performs the computation. This method will be called by AccessController.doPrivileged.

Annotations
@Override
org.glassfish.grizzly.servlet back to summary

private final Class DispatchedHttpServletRequest.GetParameterValuePrivilegedAction

extends Object
implements PrivilegedAction<String[]>
Class Inheritance
  • java.lang.Object
  • org.glassfish.grizzly.servlet.DispatchedHttpServletRequest.GetParameterValuePrivilegedAction
All Implemented Interfaces
java.security.PrivilegedAction

Field Summary

Modifier and TypeField and Description
public final String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String[]
run()

Implements java.security.PrivilegedAction.run.

Performs the computation.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

nameback to summary
public final String name

Constructor Detail

GetParameterValuePrivilegedActionback to summary
public GetParameterValuePrivilegedAction(String name)

Method Detail

runback to summary
public String[] run()

Implements java.security.PrivilegedAction.run.

Doc from java.security.PrivilegedAction.run.

Performs the computation. This method will be called by AccessController.doPrivileged.

Annotations
@Override