Package org.eclipse.jetty.client
Class HttpContentResponse
java.lang.Object
org.eclipse.jetty.client.HttpContentResponse
- All Implemented Interfaces:
ContentResponse
,Response
-
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
ConstructorDescriptionHttpContentResponse
(Response response, byte[] content, String mediaType, String encoding) -
Method Summary
Modifier and TypeMethodDescriptionboolean
Attempts to abort the receive of this response.byte[]
Returns the headers of this response.<T extends Response.ResponseListener>
List<T>getListeners
(Class<T> listenerClass) int
toString()
-
Constructor Details
-
HttpContentResponse
-
-
Method Details
-
getRequest
- Specified by:
getRequest
in interfaceResponse
- Returns:
- the request associated with this response
-
getListeners
- 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
- Specified by:
getVersion
in interfaceResponse
- Returns:
- the HTTP version of this response, such as "HTTP/1.1"
-
getStatus
public int getStatus() -
getReason
- Specified by:
getReason
in interfaceResponse
- Returns:
- the HTTP reason associated to the
Response.getStatus()
-
getHeaders
Description copied from interface:Response
Returns the headers of this response.
Some headers sent by the server may not be present, or be present but modified, while the content is being processed. A typical example is the
Content-Length
header when the content is sent compressed by the server and automatically decompressed by the client: theContent-Length
header will be removed.Similarly, the
Content-Encoding
header may be removed or modified, as the content is decoded by the client.- Specified by:
getHeaders
in interfaceResponse
- Returns:
- the headers of this response
-
abort
Description copied from interface:Response
Attempts to abort the receive of this response. -
getMediaType
- Specified by:
getMediaType
in interfaceContentResponse
- Returns:
- the media type of the content, such as "text/html" or "application/octet-stream"
-
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
- 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
-