Package org.asynchttpclient
Interface Response
- 
- All Known Implementing Classes:
- NettyResponse
 
 public interface ResponseRepresents the asynchronous HTTP response callback for anAsyncCompletionHandler
- 
- 
Nested Class SummaryNested Classes Modifier and Type Interface Description static classResponse.ResponseBuilder
 - 
Method SummaryAll Methods Instance Methods Abstract 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.
 
- 
- 
- 
Method Detail- 
getStatusCodeint getStatusCode() Returns the status code for the request.- Returns:
- The status code
 
 - 
getStatusTextString getStatusText() Returns the status text for the request.- Returns:
- The status text
 
 - 
getResponseBodyAsBytesbyte[] getResponseBodyAsBytes() Return the entire response body as a byte[].- Returns:
- the entire response body as a byte[].
 
 - 
getResponseBodyAsByteBufferByteBuffer getResponseBodyAsByteBuffer() Return the entire response body as a ByteBuffer.- Returns:
- the entire response body as a ByteBuffer.
 
 - 
getResponseBodyAsByteBufio.netty.buffer.ByteBuf getResponseBodyAsByteBuf() Return the entire response body as a ByteBuf.- Returns:
- the entire response body as a ByteBuf.
 
 - 
getResponseBodyAsStreamInputStream getResponseBodyAsStream() Returns 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.- Returns:
- The input stream
 
 - 
getResponseBodyString getResponseBody(Charset charset) Return the entire response body as a String.- Parameters:
- charset- the charset to use when decoding the stream
- Returns:
- the entire response body as a String.
 
 - 
getResponseBodyString getResponseBody() Return the entire response body as a String.- Returns:
- the entire response body as a String.
 
 - 
getUriUri getUri() Return the requestUri. Note that if the request got redirected, the value of theUriwill be the last valid redirect url.- Returns:
- the request Uri.
 
 - 
getContentTypeString getContentType() Return the content-type header value.- Returns:
- the content-type header value.
 
 - 
getHeaderString getHeader(CharSequence name) - Parameters:
- name- the header name
- Returns:
- the first response header value
 
 - 
getHeadersList<String> getHeaders(CharSequence name) Return aListof the response header value.- Parameters:
- name- the header name
- Returns:
- the response header value
 
 - 
getHeadersio.netty.handler.codec.http.HttpHeaders getHeaders() 
 - 
isRedirectedboolean isRedirected() Return true if the response redirects to another object.- Returns:
- True if the response redirects to another object.
 
 - 
toStringString toString() Subclasses SHOULD implement toString() in a way that identifies the response for logging.
 - 
getCookiesList<io.netty.handler.codec.http.cookie.Cookie> getCookies() - Returns:
- the list of Cookie.
 
 - 
hasResponseStatusboolean hasResponseStatus() Return true if the response's status has been computed by anAsyncHandler- Returns:
- true if the response's status has been computed by an AsyncHandler
 
 - 
hasResponseHeadersboolean hasResponseHeaders() 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.ABORT- Returns:
- true if the response's headers has been computed by an AsyncHandler
 
 - 
hasResponseBodyboolean hasResponseBody() Return 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
 - Returns:
- true if the response's body has been computed by an AsyncHandlerto new empty bytes
 
- either the 
 - 
getRemoteAddressSocketAddress getRemoteAddress() Get the remote address that the client initiated the request to.- Returns:
- The remote address that the client initiated the request to. May be nullif asynchronous provider is unable to provide the remote address
 
 - 
getLocalAddressSocketAddress getLocalAddress() Get the local address that the client initiated the request from.- Returns:
- The local address that the client initiated the request from. May be nullif asynchronous provider is unable to provide the local address
 
 
- 
 
-