Top Description Fields Methods
org.apache.hc.core5.http.protocol

public Interface HttpContext

Known Direct Implementers
org.apache.hc.core5.http.protocol.HttpCoreContext, org.apache.hc.core5.http.protocol.BasicHttpContext
Imports
org.apache.hc.core5.http.ProtocolVersion

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 Note

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

Modifier and TypeField and Description
public static final String
RESERVED_PREFIX

The prefix reserved for use by HTTP components.

Method Summary

Modifier and TypeMethod and Description
public Object

Returns:

attribute value, or null if not set.
getAttribute
(String
the attribute name.
id
)

Obtains attribute with the given name.

public ProtocolVersion
getProtocolVersion()

Returns protocol version used in this context.

public Object

Returns:

attribute value, or null if not set.
removeAttribute
(String
the attribute name.
id
)

Removes attribute with the given name from the context.

public Object

Returns:

the previous value associated with id, or null if there was no mapping for id.
setAttribute
(String
the attribute name.
id
,
Object
the attribute value.
obj
)

Sets value of the attribute with the given name.

public void
setProtocolVersion(ProtocolVersion version)

Sets protocol version used in this context.

Field Detail

RESERVED_PREFIXback to summary
public static final String RESERVED_PREFIX

The prefix reserved for use by HTTP components. "http."

Method Detail

getAttributeback to summary
public Object getAttribute(String id)

Obtains attribute with the given name.

Parameters
id:String

the attribute name.

Returns:Object

attribute value, or null if not set.

getProtocolVersionback to summary
public ProtocolVersion getProtocolVersion()

Returns protocol version used in this context.

Since
5.0
removeAttributeback to summary
public Object removeAttribute(String id)

Removes attribute with the given name from the context.

Parameters
id:String

the attribute name.

Returns:Object

attribute value, or null if not set.

setAttributeback to summary
public Object setAttribute(String id, Object obj)

Sets value of the attribute with the given name.

Parameters
id:String

the attribute name.

obj:Object

the attribute value.

Returns:Object

the previous value associated with id, or null if there was no mapping for id.

setProtocolVersionback to summary
public void setProtocolVersion(ProtocolVersion version)

Sets protocol version used in this context.

Since
5.0