Response.ResponseBuilder
Constructor and Description |
---|
NettyResponse(HttpResponseStatus status,
HttpResponseHeaders headers,
List<HttpResponseBodyPart> bodyParts) |
Modifier and Type | Method and Description |
---|---|
String |
getContentType()
Return the content-type header value.
|
List<Cookie> |
getCookies()
Return the list of
Cookie . |
String |
getHeader(String name)
Return the response header
|
FluentCaseInsensitiveStringsMap |
getHeaders() |
List<String> |
getHeaders(String name)
Return a
List of the response header value. |
String |
getResponseBody()
Return the entire response body as a String.
|
String |
getResponseBody(String charset)
Return the entire response body as a String.
|
ByteBuffer |
getResponseBodyAsByteBuffer()
Return the entire response body as a ByteBuffer.
|
byte[] |
getResponseBodyAsBytes()
Return the entire response body as a byte[].
|
org.jboss.netty.buffer.ChannelBuffer |
getResponseBodyAsChannelBuffer() |
InputStream |
getResponseBodyAsStream()
Returns an input stream for the response body.
|
String |
getResponseBodyExcerpt(int maxLength)
Returns the first maxLength bytes of the response body as a string.
|
String |
getResponseBodyExcerpt(int maxLength,
String charset)
Returns the first maxLength bytes of the response body as a string.
|
int |
getStatusCode()
Returns the status code for the request.
|
String |
getStatusText()
Returns the status text for the request.
|
URI |
getUri()
Return the request
URI . |
boolean |
hasResponseBody()
Return true if the response's body has been computed by an
AsyncHandler . |
boolean |
hasResponseHeaders()
Return true if the response's headers has been computed by an
AsyncHandler It will return false if the
either AsyncHandler.onStatusReceived(HttpResponseStatus)
or AsyncHandler.onHeadersReceived(HttpResponseHeaders) returned AsyncHandler.STATE.ABORT |
boolean |
hasResponseStatus()
Return true if the response's status has been computed by an
AsyncHandler |
boolean |
isRedirected()
Return true if the response redirects to another object.
|
public NettyResponse(HttpResponseStatus status, HttpResponseHeaders headers, List<HttpResponseBodyPart> bodyParts)
public int getStatusCode()
Response
getStatusCode
in interface Response
public String getStatusText()
Response
getStatusText
in interface Response
public byte[] getResponseBodyAsBytes() throws IOException
Response
getResponseBodyAsBytes
in interface Response
IOException
public ByteBuffer getResponseBodyAsByteBuffer() throws IOException
Response
getResponseBodyAsByteBuffer
in interface Response
IOException
public String getResponseBody() throws IOException
Response
getResponseBody
in interface Response
IOException
public String getResponseBody(String charset) throws IOException
Response
getResponseBody
in interface Response
charset
- the charset to use when decoding the streamIOException
public InputStream getResponseBodyAsStream() throws IOException
Response
getResponseBodyAsStream
in interface Response
IOException
public org.jboss.netty.buffer.ChannelBuffer getResponseBodyAsChannelBuffer() throws IOException
IOException
public String getResponseBodyExcerpt(int maxLength) throws IOException
Response
getResponseBodyExcerpt
in interface Response
maxLength
- The maximum number of bytes to readIOException
public String getResponseBodyExcerpt(int maxLength, String charset) throws IOException
Response
getResponseBodyExcerpt
in interface Response
maxLength
- The maximum number of bytes to readcharset
- the charset to use when decoding the streamIOException
public URI getUri() throws MalformedURLException
Response
URI
. Note that if the request got redirected, the value of the URI
will be
the last valid redirect url.getUri
in interface Response
URI
.MalformedURLException
public String getContentType()
Response
getContentType
in interface Response
public String getHeader(String name)
Response
public List<String> getHeaders(String name)
Response
List
of the response header value.getHeaders
in interface Response
public FluentCaseInsensitiveStringsMap getHeaders()
getHeaders
in interface Response
public boolean isRedirected()
Response
isRedirected
in interface Response
public List<Cookie> getCookies()
Response
Cookie
.getCookies
in interface Response
public boolean hasResponseStatus()
AsyncHandler
hasResponseStatus
in interface Response
AsyncHandler
public boolean hasResponseHeaders()
AsyncHandler
It will return false if the
either AsyncHandler.onStatusReceived(HttpResponseStatus)
or AsyncHandler.onHeadersReceived(HttpResponseHeaders)
returned AsyncHandler.STATE.ABORT
hasResponseHeaders
in interface Response
AsyncHandler
public boolean hasResponseBody()
AsyncHandler
. It will return false if the
either AsyncHandler.onStatusReceived(HttpResponseStatus)
or AsyncHandler.onHeadersReceived(HttpResponseHeaders)
returned AsyncHandler.STATE.ABORT
hasResponseBody
in interface Response
AsyncHandler
Copyright © 2014. All Rights Reserved.