Top Description Fields Constructors Methods
org.apache.catalina.core

pack-priv Class ApplicationRequest

extends ServletRequestWrapper
Class Inheritance
Imports
java.util.Arrays, .Collections, .Enumeration, .HashMap, .HashSet, .Set, jakarta.servlet.RequestDispatcher, .ServletRequest, .ServletRequestWrapper

Wrapper around a jakarta.servlet.ServletRequest that transforms an application request object (which might be the original one passed to a servlet, or might be based on the 2.3 jakarta.servlet.ServletRequestWrapper class) back into an internal org.apache.catalina.Request.

Warning

Due to Java's lack of support for multiple inheritance, all of the logic in ApplicationRequest is duplicated in ApplicationHttpRequest. Make sure that you keep these two classes in synchronization when making changes!

Author
Craig R. McClanahan

Field Summary

Modifier and TypeField and Description
protected final HashMap<String, Object>
attributes

The request attributes for this request.

private static final int
protected static final String[]
specials

Deprecated Will be removed without replacement in Tomcat 11 onwards.
The set of attribute names that are special for request dispatchers.
private static final Set<String>

Constructor Summary

AccessConstructor and Description
pack-priv
ApplicationRequest(ServletRequest
The servlet request being wrapped
request
)

Construct a new wrapped request around the specified servlet request.

Method Summary

Modifier and TypeMethod and Description
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.

protected boolean
isSpecial(String
Attribute name to be tested
name
)
Deprecated Will be made private in Tomcat 11 onwards.

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

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.

public void
setRequest(ServletRequest
The new wrapped request
request
)

Overrides jakarta.servlet.ServletRequestWrapper.setRequest.

Set the request that we are wrapping.

Inherited from jakarta.servlet.ServletRequestWrapper:
getAsyncContextgetCharacterEncodinggetContentLengthgetContentLengthLonggetContentTypegetDispatcherTypegetInputStreamgetLocalAddrgetLocalegetLocalesgetLocalNamegetLocalPortgetParametergetParameterMapgetParameterNamesgetParameterValuesgetProtocolgetProtocolRequestIdgetReadergetRemoteAddrgetRemoteHostgetRemotePortgetRequestgetRequestDispatchergetRequestIdgetSchemegetServerNamegetServerPortgetServletConnectiongetServletContextisAsyncStartedisAsyncSupportedisSecureisWrapperForisWrapperForsetCharacterEncodingstartAsyncstartAsync

Field Detail

attributesback to summary
protected final HashMap<String, Object> attributes

The request attributes for this request. This is initialized from the wrapped request, but updates are allowed.

shortestSpecialNameLengthback to summary
private static final int shortestSpecialNameLength
specialsback to summary
protected static final String[] specials

Deprecated

Will be removed without replacement in Tomcat 11 onwards.

The set of attribute names that are special for request dispatchers.

Annotations
@Deprecated
specialsSetback to summary
private static final Set<String> specialsSet

Constructor Detail

ApplicationRequestback to summary
pack-priv ApplicationRequest(ServletRequest request)

Construct a new wrapped request around the specified servlet request.

Parameters
request:ServletRequest

The servlet request being wrapped

Method Detail

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

Returns:Object

Doc from jakarta.servlet.ServletRequest.getAttribute.

an Object containing the value of the attribute, or null if the attribute does not exist

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.

Returns:Enumeration<String>

Doc from jakarta.servlet.ServletRequest.getAttributeNames.

an Enumeration of strings containing the names of the request's attributes

Annotations
@Override
isSpecialback to summary
protected boolean isSpecial(String name)

Deprecated

Will be made private in Tomcat 11 onwards.

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

Parameters
name:String

Attribute name to be tested

Annotations
@Deprecated
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
setRequestback to summary
public void setRequest(ServletRequest request)

Overrides jakarta.servlet.ServletRequestWrapper.setRequest.

Set the request that we are wrapping.

Parameters
request:ServletRequest

The new wrapped request

Annotations
@Override