Class GrizzlyResponse
java.lang.Object
com.ning.http.client.ResponseBase
com.ning.http.client.providers.grizzly.GrizzlyResponse
- All Implemented Interfaces:
Response
HttpResponseBodyPart implementation using the Grizzly 2.0 HTTP client
codec.- Since:
- 1.7.0
- Author:
- The Grizzly Team
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.ning.http.client.Response
Response.ResponseBuilder -
Field Summary
Fields inherited from class com.ning.http.client.ResponseBase
bodyParts, headers, status -
Constructor Summary
ConstructorsConstructorDescriptionGrizzlyResponse(org.glassfish.grizzly.http.HttpResponsePacket httpResponsePacket, HttpResponseStatus status, HttpResponseHeaders headers, List<HttpResponseBodyPart> bodyParts) -
Method Summary
Modifier and TypeMethodDescriptionReturn the entire response body as a String.getResponseBody(String charset) Return the entire response body as a String.Return the entire response body as a ByteBuffer.byte[]Return the entire response body as a byte[].Returns an input stream for the response body.getResponseBodyExcerpt(int maxLength) Returns the first maxLength bytes of the response body as a string.getResponseBodyExcerpt(int maxLength, String charset) Returns the first maxLength bytes of the response body as a string.Methods inherited from class com.ning.http.client.ResponseBase
calculateCharset, getContentType, getCookies, getHeader, getHeaders, getHeaders, getStatusCode, getStatusText, getUri, hasResponseBody, hasResponseHeaders, hasResponseStatus, isRedirected
-
Constructor Details
-
GrizzlyResponse
public GrizzlyResponse(org.glassfish.grizzly.http.HttpResponsePacket httpResponsePacket, HttpResponseStatus status, HttpResponseHeaders headers, List<HttpResponseBodyPart> bodyParts)
-
-
Method Details
-
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.- Returns:
- The input stream
- Throws:
IOException
-
getResponseBodyExcerpt
Description copied from interface:ResponseReturns the first maxLength bytes of the response body as a string. Note that this does not check whether the content type is actually a textual one, but it will use the charset if present in the content type header.- Parameters:
maxLength- The maximum number of bytes to readcharset- the charset to use when decoding the stream- Returns:
- The response body
- Throws:
IOException
-
getResponseBody
Description copied from interface:ResponseReturn 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.
- Throws:
IOException
-
getResponseBodyExcerpt
Description copied from interface:ResponseReturns the first maxLength bytes of the response body as a string. Note that this does not check whether the content type is actually a textual one, but it will use the charset if present in the content type header.- Parameters:
maxLength- The maximum number of bytes to read- Returns:
- The response body
- Throws:
IOException
-
getResponseBody
Description copied from interface:ResponseReturn the entire response body as a String.- Returns:
- the entire response body as a String.
- Throws:
IOException
-
getResponseBodyAsBytes
Description copied from interface:ResponseReturn the entire response body as a byte[].- Returns:
- the entire response body as a byte[].
- Throws:
IOException
-
getResponseBodyAsByteBuffer
Description copied from interface:ResponseReturn the entire response body as a ByteBuffer.- Returns:
- the entire response body as a ByteBuffer.
- Throws:
IOException
-
buildCookies
- Specified by:
buildCookiesin classResponseBase
-