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 Annotation
s and method parameter types.
See ProtocolRequestBuilder
and
ProtocolInvocationHandler
for a description of how
HttpRequest
s 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
CloseableHttpClient
public HttpCoreContext context()
ProtocolClient
HttpCoreContext
public Class<? extends P> protocol()
protocol()
Class
public P proxy()
protocol()
Proxy
public ProtocolInvocationHandler handler()
Proxy
ProtocolInvocationHandler
public Charset getCharset()
protocol()
configured Charset
public JAXBContext getJAXBContext()
protocol()
configured JAXBContext
public Marshaller getMarshaller()
protocol()
configured Marshaller
public Unmarshaller getUnmarshaller()
protocol()
configured Unmarshaller
public ObjectMapper getObjectMapper()
protocol()
configured ObjectMapper
.public void process(HttpRequest request, HttpContext context) throws IOException
process
in interface HttpRequestInterceptor
IOException
public void process(HttpResponse response, HttpContext context) throws IOException
process
in interface HttpResponseInterceptor
IOException
Copyright © 2015–2020 Allen D. Ball. All rights reserved.