class Netty4ClientHttpRequest extends AbstractAsyncClientHttpRequest implements ClientHttpRequest
ClientHttpRequest
implementation that uses
Netty 4 to execute requests.
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,
int maxRequestSize) |
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, int maxRequestSize)
public HttpMethod getMethod()
HttpRequest
getMethod
in interface HttpRequest
public java.net.URI getURI()
HttpRequest
getURI
in interface HttpRequest
protected 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
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 errorsprivate static int getPort(java.net.URI uri)
private FullHttpRequest createFullHttpRequest(HttpHeaders headers)