Package org.eclipse.jetty.client
Class HttpContentResponse
- java.lang.Object
-
- org.eclipse.jetty.client.HttpContentResponse
-
- All Implemented Interfaces:
ContentResponse
,Response
public class HttpContentResponse extends java.lang.Object implements ContentResponse
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.client.api.Response
Response.AsyncContentListener, Response.BeginListener, Response.CompleteListener, Response.ContentListener, Response.DemandedContentListener, Response.FailureListener, Response.HeaderListener, Response.HeadersListener, Response.Listener, Response.ResponseListener, Response.SuccessListener
-
-
Constructor Summary
Constructors Constructor Description HttpContentResponse(Response response, byte[] content, java.lang.String mediaType, java.lang.String encoding)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
abort(java.lang.Throwable cause)
Attempts to abort the receive of this response.byte[]
getContent()
java.lang.String
getContentAsString()
java.lang.String
getEncoding()
HttpFields
getHeaders()
<T extends Response.ResponseListener>
java.util.List<T>getListeners(java.lang.Class<T> listenerClass)
java.lang.String
getMediaType()
java.lang.String
getReason()
Request
getRequest()
int
getStatus()
HttpVersion
getVersion()
java.lang.String
toString()
-
-
-
Constructor Detail
-
HttpContentResponse
public HttpContentResponse(Response response, byte[] content, java.lang.String mediaType, java.lang.String encoding)
-
-
Method Detail
-
getRequest
public Request getRequest()
- Specified by:
getRequest
in interfaceResponse
- Returns:
- the request associated with this response
-
getListeners
public <T extends Response.ResponseListener> java.util.List<T> getListeners(java.lang.Class<T> listenerClass)
- Specified by:
getListeners
in interfaceResponse
- Type Parameters:
T
- the type of class- Parameters:
listenerClass
- the listener class- Returns:
- the response listener passed to
Request.send(org.eclipse.jetty.client.api.Response.CompleteListener)
-
getVersion
public HttpVersion getVersion()
- Specified by:
getVersion
in interfaceResponse
- Returns:
- the HTTP version of this response, such as "HTTP/1.1"
-
getStatus
public int getStatus()
-
getReason
public java.lang.String getReason()
- Specified by:
getReason
in interfaceResponse
- Returns:
- the HTTP reason associated to the
Response.getStatus()
-
getHeaders
public HttpFields getHeaders()
- Specified by:
getHeaders
in interfaceResponse
- Returns:
- the headers of this response
-
abort
public boolean abort(java.lang.Throwable cause)
Description copied from interface:Response
Attempts to abort the receive of this response.
-
getMediaType
public java.lang.String getMediaType()
- Specified by:
getMediaType
in interfaceContentResponse
- Returns:
- the media type of the content, such as "text/html" or "application/octet-stream"
-
getEncoding
public java.lang.String getEncoding()
- Specified by:
getEncoding
in interfaceContentResponse
- Returns:
- the encoding of the content, such as "UTF-8"
-
getContent
public byte[] getContent()
- Specified by:
getContent
in interfaceContentResponse
- Returns:
- the response content
-
getContentAsString
public java.lang.String getContentAsString()
- Specified by:
getContentAsString
in interfaceContentResponse
- Returns:
- the response content as a string, decoding the bytes using the charset
provided by the
Content-Type
header, if any, or UTF-8.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-