P - The protocol type erasure.
This class provides:
HttpClient (client())
HttpContext (context())
Proxy which implements the annotated protocol interface
this implements HttpRequestInterceptor
and HttpResponseInterceptor which are configured into
HttpClientBuilder; subclasses can override
process(HttpRequest,HttpContext) and
process(HttpResponse,HttpContext)
See the ProtocolRequestBuilder for the supported protocol
interface Annotations and method parameter types.
See ProtocolRequestBuilder and
ProtocolInvocationHandler for a description of how
HttpRequests are generated and executed.
public abstract class ProtocolClient<P> extends Object implements HttpRequestInterceptor, HttpResponseInterceptor
ProtocolClient base class.| Modifier and Type | Field and Description |
|---|---|
protected Charset |
charset
Field exposed for subclass initialization;
see
getCharset(). |
protected JAXBContext |
jaxb
Field exposed for subclass initialization;
see
getJAXBContext(). |
protected ObjectMapper |
mapper
Field exposed for subclass initialization;
see
getObjectMapper(). |
| Modifier | Constructor and Description |
|---|---|
protected |
ProtocolClient(Class<? extends P> protocol)
Constructor that creates
HttpClientBuilder
and HttpCoreContext. |
protected |
ProtocolClient(HttpClientBuilder builder,
HttpCoreContext context,
Class<? extends P> protocol)
Constructor that allows the subclass to provide a configured
HttpClientBuilder and/or HttpCoreContext. |
| Modifier and Type | Method and Description |
|---|---|
CloseableHttpClient |
client() |
HttpCoreContext |
context() |
Charset |
getCharset() |
JAXBContext |
getJAXBContext() |
Marshaller |
getMarshaller() |
ObjectMapper |
getObjectMapper() |
Unmarshaller |
getUnmarshaller() |
ProtocolInvocationHandler |
handler() |
void |
process(HttpRequest request,
HttpContext context) |
void |
process(HttpResponse response,
HttpContext context) |
Class<? extends P> |
protocol() |
P |
proxy() |
protected transient Charset charset
getCharset().protected transient JAXBContext jaxb
getJAXBContext().protected transient ObjectMapper mapper
getObjectMapper().protected ProtocolClient(Class<? extends P> protocol)
HttpClientBuilder
and HttpCoreContext.protocol - The protocol Class.protected ProtocolClient(HttpClientBuilder builder, HttpCoreContext context, Class<? extends P> protocol)
HttpClientBuilder and/or HttpCoreContext.builder - A configured HttpClientBuilder.context - A HttpCoreContext (may be
null).protocol - The protocol Class.public CloseableHttpClient client()
ProtocolClient CloseableHttpClientpublic HttpCoreContext context()
ProtocolClient HttpCoreContextpublic Class<? extends P> protocol()
protocol() Classpublic P proxy()
protocol() Proxypublic ProtocolInvocationHandler handler()
Proxy ProtocolInvocationHandlerpublic Charset getCharset()
protocol() configured Charsetpublic JAXBContext getJAXBContext()
protocol() configured JAXBContextpublic Marshaller getMarshaller()
protocol() configured Marshallerpublic Unmarshaller getUnmarshaller()
protocol() configured Unmarshallerpublic ObjectMapper getObjectMapper()
protocol() configured ObjectMapper.public void process(HttpRequest request, HttpContext context) throws IOException
process in interface HttpRequestInterceptorIOExceptionpublic void process(HttpResponse response, HttpContext context) throws IOException
process in interface HttpResponseInterceptorIOExceptionCopyright © 2015–2020 Allen D. Ball. All rights reserved.