com.ning.http.client.providers
Class NettyAsyncResponse

java.lang.Object
  extended by com.ning.http.client.providers.NettyAsyncResponse
All Implemented Interfaces:
Response

public class NettyAsyncResponse
extends Object
implements Response

Wrapper around the Response API.


Constructor Summary
NettyAsyncResponse(HttpResponseStatus status, HttpResponseHeaders headers, Collection<HttpResponseBodyPart> bodyParts)
           
 
Method Summary
 String getContentType()
          Return the content-type header value.
 List<Cookie> getCookies()
          Return the list of Cookie.
 String getHeader(String name)
          Return the response header
 Headers getHeaders()
           
 List<String> getHeaders(String name)
          Return a List of the response header value.
 String getResponseBody()
          Return the entire response body as a String.
 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.
 int getStatusCode()
          Returns the status code for the request.
 String getStatusText()
          Returns the status text for the request.
 Url getUrl()
          Return the request Url.
 boolean isRedirected()
          Return true if the response redirects to another object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ning.http.client.Response
toString
 

Constructor Detail

NettyAsyncResponse

public NettyAsyncResponse(HttpResponseStatus status,
                          HttpResponseHeaders headers,
                          Collection<HttpResponseBodyPart> bodyParts)
Method Detail

getStatusCode

public int getStatusCode()
Description copied from interface: Response
Returns the status code for the request.

Specified by:
getStatusCode in interface Response
Returns:
The status code

getStatusText

public String getStatusText()
Description copied from interface: Response
Returns the status text for the request.

Specified by:
getStatusText in interface Response
Returns:
The status text

getResponseBody

public String getResponseBody()
                       throws IOException
Description copied from interface: Response
Return the entire response body as a String.

Specified by:
getResponseBody in interface Response
Returns:
the entire response body as a String.
Throws:
IOException

getResponseBodyAsStream

public InputStream getResponseBodyAsStream()
                                    throws IOException
Description copied from interface: Response
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.

Specified by:
getResponseBodyAsStream in interface Response
Returns:
The input stream
Throws:
IOException

getResponseBodyExcerpt

public String getResponseBodyExcerpt(int maxLength)
                              throws IOException
Description copied from interface: Response
Returns 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.

Specified by:
getResponseBodyExcerpt in interface Response
Parameters:
maxLength - The maximum number of bytes to read
Returns:
The response body
Throws:
IOException

getUrl

public Url getUrl()
           throws MalformedURLException
Description copied from interface: Response
Return the request Url. Note that if the request got redirected, the value of the Url will be the last valid redirect url.

Specified by:
getUrl in interface Response
Returns:
the request Url.
Throws:
MalformedURLException

getContentType

public String getContentType()
Description copied from interface: Response
Return the content-type header value.

Specified by:
getContentType in interface Response
Returns:
the content-type header value.

getHeader

public String getHeader(String name)
Description copied from interface: Response
Return the response header

Specified by:
getHeader in interface Response
Returns:
the response header

getHeaders

public List<String> getHeaders(String name)
Description copied from interface: Response
Return a List of the response header value.

Specified by:
getHeaders in interface Response
Returns:
the response header

getHeaders

public Headers getHeaders()
Specified by:
getHeaders in interface Response

isRedirected

public boolean isRedirected()
Description copied from interface: Response
Return true if the response redirects to another object.

Specified by:
isRedirected in interface Response
Returns:
True if the response redirects to another object.

getCookies

public List<Cookie> getCookies()
Description copied from interface: Response
Return the list of Cookie.

Specified by:
getCookies in interface Response


Copyright © 2010. All Rights Reserved.