Package org.asynchttpclient.netty
Class NettyResponse
- java.lang.Object
- 
- org.asynchttpclient.netty.NettyResponse
 
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from interface org.asynchttpclient.ResponseResponse.ResponseBuilder
 
- 
 - 
Constructor SummaryConstructors Constructor Description NettyResponse(HttpResponseStatus status, io.netty.handler.codec.http.HttpHeaders headers, List<HttpResponseBodyPart> bodyParts)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetContentType()Return the content-type header value.List<io.netty.handler.codec.http.cookie.Cookie>getCookies()StringgetHeader(CharSequence name)io.netty.handler.codec.http.HttpHeadersgetHeaders()List<String>getHeaders(CharSequence name)Return aListof the response header value.SocketAddressgetLocalAddress()Get the local address that the client initiated the request from.SocketAddressgetRemoteAddress()Get the remote address that the client initiated the request to.StringgetResponseBody()Return the entire response body as a String.StringgetResponseBody(Charset charset)Return the entire response body as a String.io.netty.buffer.ByteBufgetResponseBodyAsByteBuf()Return the entire response body as a ByteBuf.ByteBuffergetResponseBodyAsByteBuffer()Return the entire response body as a ByteBuffer.byte[]getResponseBodyAsBytes()Return the entire response body as a byte[].InputStreamgetResponseBodyAsStream()Returns an input stream for the response body.intgetStatusCode()Returns the status code for the request.StringgetStatusText()Returns the status text for the request.UrigetUri()Return the requestUri.booleanhasResponseBody()Return true if the response's body has been computed by anAsyncHandler.booleanhasResponseHeaders()Return true if the response's headers has been computed by anAsyncHandlerIt will return false if the eitherAsyncHandler.onStatusReceived(HttpResponseStatus)orAsyncHandler.onHeadersReceived(HttpHeaders)returnedAsyncHandler.State.ABORTbooleanhasResponseStatus()Return true if the response's status has been computed by anAsyncHandlerbooleanisRedirected()Return true if the response redirects to another object.StringtoString()Subclasses SHOULD implement toString() in a way that identifies the response for logging.
 
- 
- 
- 
Constructor Detail- 
NettyResponsepublic NettyResponse(HttpResponseStatus status, io.netty.handler.codec.http.HttpHeaders headers, List<HttpResponseBodyPart> bodyParts) 
 
- 
 - 
Method Detail- 
getStatusCodepublic final int getStatusCode() Description copied from interface:ResponseReturns the status code for the request.- Specified by:
- getStatusCodein interface- Response
- Returns:
- The status code
 
 - 
getStatusTextpublic final String getStatusText() Description copied from interface:ResponseReturns the status text for the request.- Specified by:
- getStatusTextin interface- Response
- Returns:
- The status text
 
 - 
getRemoteAddresspublic SocketAddress getRemoteAddress() Description copied from interface:ResponseGet the remote address that the client initiated the request to.- Specified by:
- getRemoteAddressin interface- Response
- Returns:
- The remote address that the client initiated the request to. May be nullif asynchronous provider is unable to provide the remote address
 
 - 
getLocalAddresspublic SocketAddress getLocalAddress() Description copied from interface:ResponseGet the local address that the client initiated the request from.- Specified by:
- getLocalAddressin interface- Response
- Returns:
- The local address that the client initiated the request from. May be nullif asynchronous provider is unable to provide the local address
 
 - 
getContentTypepublic final String getContentType() Description copied from interface:ResponseReturn the content-type header value.- Specified by:
- getContentTypein interface- Response
- Returns:
- the content-type header value.
 
 - 
getHeaderpublic final String getHeader(CharSequence name) 
 - 
getHeaderspublic final List<String> getHeaders(CharSequence name) Description copied from interface:ResponseReturn aListof the response header value.- Specified by:
- getHeadersin interface- Response
- Parameters:
- name- the header name
- Returns:
- the response header value
 
 - 
getHeaderspublic final io.netty.handler.codec.http.HttpHeaders getHeaders() - Specified by:
- getHeadersin interface- Response
 
 - 
isRedirectedpublic final boolean isRedirected() Description copied from interface:ResponseReturn true if the response redirects to another object.- Specified by:
- isRedirectedin interface- Response
- Returns:
- True if the response redirects to another object.
 
 - 
getCookiespublic List<io.netty.handler.codec.http.cookie.Cookie> getCookies() - Specified by:
- getCookiesin interface- Response
- Returns:
- the list of Cookie.
 
 - 
hasResponseStatuspublic boolean hasResponseStatus() Description copied from interface:ResponseReturn true if the response's status has been computed by anAsyncHandler- Specified by:
- hasResponseStatusin interface- Response
- Returns:
- true if the response's status has been computed by an AsyncHandler
 
 - 
hasResponseHeaderspublic boolean hasResponseHeaders() Description copied from interface:ResponseReturn true if the response's headers has been computed by anAsyncHandlerIt will return false if the eitherAsyncHandler.onStatusReceived(HttpResponseStatus)orAsyncHandler.onHeadersReceived(HttpHeaders)returnedAsyncHandler.State.ABORT- Specified by:
- hasResponseHeadersin interface- Response
- Returns:
- true if the response's headers has been computed by an AsyncHandler
 
 - 
hasResponseBodypublic boolean hasResponseBody() Description copied from interface:ResponseReturn true if the response's body has been computed by anAsyncHandler. It will return false if:- either the AsyncHandler.onStatusReceived(HttpResponseStatus)returnedAsyncHandler.State.ABORT
- or AsyncHandler.onHeadersReceived(HttpHeaders)returnedAsyncHandler.State.ABORT
- response body was empty
 - Specified by:
- hasResponseBodyin interface- Response
- Returns:
- true if the response's body has been computed by an AsyncHandlerto new empty bytes
 
- either the 
 - 
getResponseBodyAsBytespublic byte[] getResponseBodyAsBytes() Description copied from interface:ResponseReturn the entire response body as a byte[].- Specified by:
- getResponseBodyAsBytesin interface- Response
- Returns:
- the entire response body as a byte[].
 
 - 
getResponseBodyAsByteBufferpublic ByteBuffer getResponseBodyAsByteBuffer() Description copied from interface:ResponseReturn the entire response body as a ByteBuffer.- Specified by:
- getResponseBodyAsByteBufferin interface- Response
- Returns:
- the entire response body as a ByteBuffer.
 
 - 
getResponseBodyAsByteBufpublic io.netty.buffer.ByteBuf getResponseBodyAsByteBuf() Description copied from interface:ResponseReturn the entire response body as a ByteBuf.- Specified by:
- getResponseBodyAsByteBufin interface- Response
- Returns:
- the entire response body as a ByteBuf.
 
 - 
getResponseBodypublic String getResponseBody() Description copied from interface:ResponseReturn the entire response body as a String.- Specified by:
- getResponseBodyin interface- Response
- Returns:
- the entire response body as a String.
 
 - 
getResponseBodypublic String getResponseBody(Charset charset) Description copied from interface:ResponseReturn the entire response body as a String.- Specified by:
- getResponseBodyin interface- Response
- Parameters:
- charset- the charset to use when decoding the stream
- Returns:
- the entire response body as a String.
 
 - 
getResponseBodyAsStreampublic InputStream getResponseBodyAsStream() Description copied from interface:ResponseReturns an input stream for the response body. Note that you should not try to get this more than once, and that you should not close the stream.- Specified by:
- getResponseBodyAsStreamin interface- Response
- Returns:
- The input stream
 
 
- 
 
-