class Netty4ClientHttpRequest extends AbstractAsyncClientHttpRequest implements ClientHttpRequest
ClientHttpRequest
implementation based on Netty 4.
Created via the Netty4ClientHttpRequestFactory
.
Modifier and Type | Class and Description |
---|---|
private static class |
Netty4ClientHttpRequest.RequestExecuteHandler
A SimpleChannelInboundHandler to update the given SettableListenableFuture.
|
Modifier and Type | Field and Description |
---|---|
private ByteBufOutputStream |
body |
private Bootstrap |
bootstrap |
private HttpMethod |
method |
private java.net.URI |
uri |
Constructor and Description |
---|
Netty4ClientHttpRequest(Bootstrap bootstrap,
java.net.URI uri,
HttpMethod method) |
Modifier and Type | Method and Description |
---|---|
private FullHttpRequest |
createFullHttpRequest(HttpHeaders headers) |
ClientHttpResponse |
execute()
Execute this request, resulting in a
ClientHttpResponse that can be read. |
protected ListenableFuture<ClientHttpResponse> |
executeInternal(HttpHeaders headers)
Abstract template method that writes the given headers and content to the HTTP request.
|
protected java.io.OutputStream |
getBodyInternal(HttpHeaders headers)
Abstract template method that returns the body.
|
HttpMethod |
getMethod()
Return the HTTP method of the request.
|
private static int |
getPort(java.net.URI uri) |
java.net.URI |
getURI()
Return the URI of the request.
|
assertNotExecuted, executeAsync, getBody, getHeaders
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getBody
getHeaders
private final Bootstrap bootstrap
private final java.net.URI uri
private final HttpMethod method
private final ByteBufOutputStream body
public Netty4ClientHttpRequest(Bootstrap bootstrap, java.net.URI uri, HttpMethod method)
public HttpMethod getMethod()
HttpRequest
getMethod
in interface HttpRequest
null
if not resolvable (e.g. in case of a non-standard HTTP method)public java.net.URI getURI()
HttpRequest
getURI
in interface HttpRequest
null
)public ClientHttpResponse execute() throws java.io.IOException
ClientHttpRequest
ClientHttpResponse
that can be read.execute
in interface ClientHttpRequest
java.io.IOException
- in case of I/O errorsprotected java.io.OutputStream getBodyInternal(HttpHeaders headers) throws java.io.IOException
AbstractAsyncClientHttpRequest
getBodyInternal
in class AbstractAsyncClientHttpRequest
headers
- the HTTP headersjava.io.IOException
protected ListenableFuture<ClientHttpResponse> executeInternal(HttpHeaders headers) throws java.io.IOException
AbstractAsyncClientHttpRequest
executeInternal
in class AbstractAsyncClientHttpRequest
headers
- the HTTP headersjava.io.IOException
private FullHttpRequest createFullHttpRequest(HttpHeaders headers)
private static int getPort(java.net.URI uri)