Interface HttpContext
-
- All Known Implementing Classes:
BasicHttpContext
,HttpCoreContext
public interface HttpContext
HttpContext represents execution state of an HTTP process. It is a structure that can be used to map an attribute name to an attribute value.The primary purpose of the HTTP context is to facilitate information sharing among various logically related components. HTTP context can be used to store a processing state for one message or several consecutive messages. Multiple logically related messages can participate in a logical session if the same context is reused between consecutive messages.
IMPORTANT: Please note HTTP context implementation, even when thread safe, may not be used concurrently by multiple threads, as the context may contain thread unsafe attributes.
- Since:
- 4.0
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
RESERVED_PREFIX
The prefix reserved for use by HTTP components.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.Object
getAttribute(java.lang.String id)
Obtains attribute with the given name.ProtocolVersion
getProtocolVersion()
Returns protocol version used in this context.java.lang.Object
removeAttribute(java.lang.String id)
Removes attribute with the given name from the context.java.lang.Object
setAttribute(java.lang.String id, java.lang.Object obj)
Sets value of the attribute with the given name.void
setProtocolVersion(ProtocolVersion version)
Sets protocol version used in this context.
-
-
-
Field Detail
-
RESERVED_PREFIX
static final java.lang.String RESERVED_PREFIX
The prefix reserved for use by HTTP components. "http."- See Also:
- Constant Field Values
-
-
Method Detail
-
getProtocolVersion
ProtocolVersion getProtocolVersion()
Returns protocol version used in this context.- Since:
- 5.0
-
setProtocolVersion
void setProtocolVersion(ProtocolVersion version)
Sets protocol version used in this context.- Since:
- 5.0
-
getAttribute
java.lang.Object getAttribute(java.lang.String id)
Obtains attribute with the given name.- Parameters:
id
- the attribute name.- Returns:
- attribute value, or
null
if not set.
-
setAttribute
java.lang.Object setAttribute(java.lang.String id, java.lang.Object obj)
Sets value of the attribute with the given name.- Parameters:
id
- the attribute name.obj
- the attribute value.- Returns:
- the previous value associated with
id
, ornull
if there was no mapping forid
.
-
removeAttribute
java.lang.Object removeAttribute(java.lang.String id)
Removes attribute with the given name from the context.- Parameters:
id
- the attribute name.- Returns:
- attribute value, or
null
if not set.
-
-