Class ContentResponseHandler
- java.lang.Object
-
- org.apache.hc.client5.http.impl.classic.AbstractHttpClientResponseHandler<Content>
-
- org.apache.hc.client5.http.fluent.ContentResponseHandler
-
- All Implemented Interfaces:
org.apache.hc.core5.http.io.HttpClientResponseHandler<Content>
public class ContentResponseHandler extends AbstractHttpClientResponseHandler<Content>
- Since:
- 4.4
- See Also:
Content
-
-
Field Summary
Fields Modifier and Type Field Description private static int
MAX_MESSAGE_LENGTH
The maximum length of the exception message, to avoid excessive memory usage.
-
Constructor Summary
Constructors Constructor Description ContentResponseHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Content
handleEntity(org.apache.hc.core5.http.HttpEntity entity)
Handle the response entity and transform it into the actual response object.Content
handleResponse(org.apache.hc.core5.http.ClassicHttpResponse response)
Handles a successful response (2xx status code) and returns the response entity as aContent
object.
-
-
-
Field Detail
-
MAX_MESSAGE_LENGTH
private static final int MAX_MESSAGE_LENGTH
The maximum length of the exception message, to avoid excessive memory usage.- See Also:
- Constant Field Values
-
-
Method Detail
-
handleEntity
public Content handleEntity(org.apache.hc.core5.http.HttpEntity entity) throws java.io.IOException
Description copied from class:AbstractHttpClientResponseHandler
Handle the response entity and transform it into the actual response object.- Specified by:
handleEntity
in classAbstractHttpClientResponseHandler<Content>
- Throws:
java.io.IOException
-
handleResponse
public Content handleResponse(org.apache.hc.core5.http.ClassicHttpResponse response) throws java.io.IOException
Handles a successful response (2xx status code) and returns the response entity as aContent
object. If no response entity exists,Content.NO_CONTENT
is returned.- Specified by:
handleResponse
in interfaceorg.apache.hc.core5.http.io.HttpClientResponseHandler<Content>
- Overrides:
handleResponse
in classAbstractHttpClientResponseHandler<Content>
- Parameters:
response
- the HTTP response.- Returns:
- a
Content
object that encapsulates the response body, orContent.NO_CONTENT
if the response body isnull
or has zero length. - Throws:
HttpResponseException
- if the response was unsuccessful (status code greater than 300).java.io.IOException
- if an I/O error occurs.
-
-