public class HttpCoreContext extends Object implements HttpContext
HttpContext
.
IMPORTANT: This class is NOT thread-safe and MUST NOT be used concurrently by multiple message exchanges.
Modifier and Type | Field and Description |
---|---|
static String |
CONNECTION_ENDPOINT
Deprecated.
Use getter methods
|
static String |
HTTP_REQUEST
Deprecated.
Use getter methods
|
static String |
HTTP_RESPONSE
Deprecated.
Use getter methods
|
static String |
SSL_SESSION
Deprecated.
Use getter methods
|
RESERVED_PREFIX
Constructor and Description |
---|
HttpCoreContext() |
HttpCoreContext(HttpContext parentContext) |
Modifier and Type | Method and Description |
---|---|
static HttpCoreContext |
adapt(HttpContext context)
Deprecated.
Use
cast(HttpContext) . |
static HttpCoreContext |
cast(HttpContext context)
Casts the given generic
HttpContext as HttpCoreContext . |
static HttpCoreContext |
castOrCreate(HttpContext context)
Casts the given generic
HttpContext as HttpCoreContext or
creates new HttpCoreContext if the given context is null. |
static HttpCoreContext |
create() |
Object |
getAttribute(String id)
Obtains attribute with the given name.
|
<T> T |
getAttribute(String id,
Class<T> clazz) |
EndpointDetails |
getEndpointDetails()
Represents current connection endpoint details.
|
ProtocolVersion |
getProtocolVersion()
Represents the protocol version used by the message exchange.
|
HttpRequest |
getRequest()
Represents current request message head.
|
HttpResponse |
getResponse()
Represents current response message head.
|
SSLSession |
getSSLSession()
Represents current TLS session details.
|
Object |
removeAttribute(String id)
Removes attribute with the given name from the context.
|
Object |
setAttribute(String id,
Object obj)
Sets value of the attribute with the given name.
|
void |
setEndpointDetails(EndpointDetails endpointDetails) |
void |
setProtocolVersion(ProtocolVersion version)
Sets protocol version used in this context.
|
void |
setRequest(HttpRequest request) |
void |
setResponse(HttpResponse response) |
void |
setSSLSession(SSLSession sslSession) |
String |
toString() |
@Deprecated public static final String CONNECTION_ENDPOINT
@Deprecated public static final String SSL_SESSION
@Deprecated public static final String HTTP_REQUEST
@Deprecated public static final String HTTP_RESPONSE
public HttpCoreContext(HttpContext parentContext)
public HttpCoreContext()
public static HttpCoreContext create()
@Deprecated public static HttpCoreContext adapt(HttpContext context)
cast(HttpContext)
.public static HttpCoreContext cast(HttpContext context)
HttpContext
as HttpCoreContext
.public static HttpCoreContext castOrCreate(HttpContext context)
HttpContext
as HttpCoreContext
or
creates new HttpCoreContext
if the given context is null.public ProtocolVersion getProtocolVersion()
This context attribute is expected to be populated by the protocol handler in the course of request execution.
getProtocolVersion
in interface HttpContext
public void setProtocolVersion(ProtocolVersion version)
HttpContext
setProtocolVersion
in interface HttpContext
public Object getAttribute(String id)
HttpContext
getAttribute
in interface HttpContext
id
- the attribute name.null
if not set.public Object setAttribute(String id, Object obj)
HttpContext
setAttribute
in interface HttpContext
id
- the attribute name.obj
- the attribute value.id
, or
null
if there was no mapping for id
.public Object removeAttribute(String id)
HttpContext
removeAttribute
in interface HttpContext
id
- the attribute name.null
if not set.public HttpRequest getRequest()
This context attribute is expected to be populated by the protocol handler in the course of request execution.
@Internal public void setRequest(HttpRequest request)
public HttpResponse getResponse()
This context attribute is expected to be populated by the protocol handler in the course of request execution.
@Internal public void setResponse(HttpResponse response)
public EndpointDetails getEndpointDetails()
This context attribute is expected to be populated by the protocol handler in the course of request execution.
@Internal public void setEndpointDetails(EndpointDetails endpointDetails)
public SSLSession getSSLSession()
This context attribute is expected to be populated by the protocol handler in the course of request execution.
@Internal public void setSSLSession(SSLSession sslSession)
Copyright © 2005–2021 The Apache Software Foundation. All rights reserved.