Class HttpCoreContext
java.lang.Object
org.apache.hc.core5.http.protocol.HttpCoreContext
- All Implemented Interfaces:
HttpContext
- Direct Known Subclasses:
HttpCoreContext.Delegate
Core execution
HttpContext.
IMPORTANT: This class is NOT thread-safe and MUST NOT be used concurrently by multiple message exchanges.
- Since:
- 4.3
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static classInternal adaptor class that delegates all its method calls to a plainHttpContext. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringDeprecated.Use getter methodsprivate EndpointDetailsstatic final StringDeprecated.Use getter methodsstatic final StringDeprecated.Use getter methodsprivate final HttpContextprivate HttpRequestprivate HttpResponsestatic final StringDeprecated.Use getter methodsprivate SSLSessionprivate ProtocolVersionFields inherited from interface HttpContext
RESERVED_PREFIX -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic HttpCoreContextadapt(HttpContext context) Deprecated.Usecast(HttpContext).static HttpCoreContextcast(HttpContext context) Casts the given genericHttpContextasHttpCoreContext.static HttpCoreContextcastOrCreate(HttpContext context) Casts the given genericHttpContextasHttpCoreContextor creates newHttpCoreContextif the given context is null.static HttpCoreContextcreate()getAttribute(String id) Obtains attribute with the given name.<T> TgetAttribute(String id, Class<T> clazz) Represents current connection endpoint details.Represents the protocol version used by the message exchange.Represents current request message head.Represents current response message head.Represents current TLS session details.Removes attribute with the given name from the context.setAttribute(String id, Object obj) Sets value of the attribute with the given name.voidsetEndpointDetails(EndpointDetails endpointDetails) voidsetProtocolVersion(ProtocolVersion version) Sets protocol version used in this context.voidsetRequest(HttpRequest request) voidsetResponse(HttpResponse response) voidsetSSLSession(SSLSession sslSession) toString()
-
Field Details
-
CONNECTION_ENDPOINT
-
SSL_SESSION
-
HTTP_REQUEST
-
HTTP_RESPONSE
-
parentContext
-
map
-
version
-
request
-
response
-
endpointDetails
-
sslSession
-
-
Constructor Details
-
HttpCoreContext
-
HttpCoreContext
public HttpCoreContext()
-
-
Method Details
-
create
-
adapt
Deprecated.Usecast(HttpContext). -
cast
Casts the given genericHttpContextasHttpCoreContext.- Since:
- 5.3
-
castOrCreate
Casts the given genericHttpContextasHttpCoreContextor creates newHttpCoreContextif the given context is null.- Since:
- 5.4
-
getProtocolVersion
Represents the protocol version used by the message exchange.This context attribute is expected to be populated by the protocol handler in the course of request execution.
- Specified by:
getProtocolVersionin interfaceHttpContext- Since:
- 5.0
-
setProtocolVersion
Description copied from interface:HttpContextSets protocol version used in this context.- Specified by:
setProtocolVersionin interfaceHttpContext- Since:
- 5.0
-
getAttribute
Description copied from interface:HttpContextObtains attribute with the given name.- Specified by:
getAttributein interfaceHttpContext- Parameters:
id- the attribute name.- Returns:
- attribute value, or
nullif not set.
-
setAttribute
Description copied from interface:HttpContextSets value of the attribute with the given name.- Specified by:
setAttributein interfaceHttpContext- Parameters:
id- the attribute name.obj- the attribute value.- Returns:
- the previous value associated with
id, ornullif there was no mapping forid.
-
removeAttribute
Description copied from interface:HttpContextRemoves attribute with the given name from the context.- Specified by:
removeAttributein interfaceHttpContext- Parameters:
id- the attribute name.- Returns:
- attribute value, or
nullif not set.
-
getAttribute
-
getRequest
Represents current request message head.This context attribute is expected to be populated by the protocol handler in the course of request execution.
-
setRequest
- Since:
- 5.3
-
getResponse
Represents current response message head.This context attribute is expected to be populated by the protocol handler in the course of request execution.
-
setResponse
- Since:
- 5.3
-
getEndpointDetails
Represents current connection endpoint details.This context attribute is expected to be populated by the protocol handler in the course of request execution.
- Since:
- 5.0
-
setEndpointDetails
- Since:
- 5.3
-
getSSLSession
Represents current TLS session details.This context attribute is expected to be populated by the protocol handler in the course of request execution.
- Since:
- 5.0
-
setSSLSession
- Since:
- 5.3
-
toString
-