Package org.apache.http.protocol
Class HttpCoreContext
java.lang.Object
org.apache.http.protocol.HttpCoreContext
- All Implemented Interfaces:
HttpContext
- Direct Known Subclasses:
HttpClientContext
Implementation of
HttpContext
that provides convenience
setters for user assignable attributes and getter for readable attributes.- Since:
- 4.3
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Attribute name of aHttpConnection
object that represents the actual HTTP connection.static final String
Attribute name of aBoolean
object that represents the the flag indicating whether the actual request has been fully transmitted to the target host.static final String
Attribute name of aHttpRequest
object that represents the actual HTTP request.static final String
Attribute name of aHttpResponse
object that represents the actual HTTP response.static final String
Attribute name of aHttpHost
object that represents the connection target.Fields inherited from interface org.apache.http.protocol.HttpContext
RESERVED_PREFIX
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic HttpCoreContext
adapt
(HttpContext context) static HttpCoreContext
create()
getAttribute
(String id) Obtains attribute with the given name.<T> T
getAttribute
(String attribname, Class<T> clazz) <T extends HttpConnection>
TgetConnection
(Class<T> clazz) boolean
Removes attribute with the given name from the context.void
setAttribute
(String id, Object obj) Sets value of the attribute with the given name.void
setTargetHost
(HttpHost host)
-
Field Details
-
HTTP_CONNECTION
Attribute name of aHttpConnection
object that represents the actual HTTP connection.- See Also:
-
HTTP_REQUEST
Attribute name of aHttpRequest
object that represents the actual HTTP request.- See Also:
-
HTTP_RESPONSE
Attribute name of aHttpResponse
object that represents the actual HTTP response.- See Also:
-
HTTP_TARGET_HOST
Attribute name of aHttpHost
object that represents the connection target.- See Also:
-
HTTP_REQ_SENT
Attribute name of aBoolean
object that represents the the flag indicating whether the actual request has been fully transmitted to the target host.- See Also:
-
-
Constructor Details
-
HttpCoreContext
-
HttpCoreContext
public HttpCoreContext()
-
-
Method Details
-
create
-
adapt
-
getAttribute
Description copied from interface:HttpContext
Obtains attribute with the given name.- Specified by:
getAttribute
in interfaceHttpContext
- Parameters:
id
- the attribute name.- Returns:
- attribute value, or
null
if not set.
-
setAttribute
Description copied from interface:HttpContext
Sets value of the attribute with the given name.- Specified by:
setAttribute
in interfaceHttpContext
- Parameters:
id
- the attribute name.obj
- the attribute value.
-
removeAttribute
Description copied from interface:HttpContext
Removes attribute with the given name from the context.- Specified by:
removeAttribute
in interfaceHttpContext
- Parameters:
id
- the attribute name.- Returns:
- attribute value, or
null
if not set.
-
getAttribute
-
getConnection
-
getConnection
-
getRequest
-
isRequestSent
public boolean isRequestSent() -
getResponse
-
setTargetHost
-
getTargetHost
-