Package com.helger.httpclient.response
Class AbstractResponseHandlerJson<T extends com.helger.json.IJson,IMPLTYPE extends AbstractResponseHandlerJson<T,IMPLTYPE>>
java.lang.Object
com.helger.httpclient.response.AbstractResponseHandlerJson<T,IMPLTYPE>
- Type Parameters:
T- Return typeIMPLTYPE- Implementation type
- All Implemented Interfaces:
com.helger.base.trait.IGenericImplTrait<IMPLTYPE>,org.apache.hc.core5.http.io.HttpClientResponseHandler<T>
- Direct Known Subclasses:
ResponseHandlerJson,ResponseHandlerJsonArray,ResponseHandlerJsonObject
public abstract class AbstractResponseHandlerJson<T extends com.helger.json.IJson,IMPLTYPE extends AbstractResponseHandlerJson<T,IMPLTYPE>>
extends Object
implements org.apache.hc.core5.http.io.HttpClientResponseHandler<T>, com.helger.base.trait.IGenericImplTrait<IMPLTYPE>
Convert a valid HTTP response to an
IJson object.- Since:
- 10.4.0
- Author:
- Philip Helger
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractResponseHandlerJson(Function<com.helger.json.IJson, T> aMapper) -
Method Summary
Modifier and TypeMethodDescriptionfinal CharsethandleResponse(org.apache.hc.core5.http.ClassicHttpResponse aHttpResponse) final booleanfinal IMPLTYPEsetDebugMode(boolean bDebugMode) Enable or disable debug mode on demand.final IMPLTYPEsetFallbackCharset(Charset aFallbackCharset) Set the fallback charset to be used, if the payload has no charset.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.helger.base.trait.IGenericImplTrait
thisAsT
-
Field Details
-
DEFAULT_DEBUG_MODE
public static final boolean DEFAULT_DEBUG_MODE- See Also:
-
-
Constructor Details
-
AbstractResponseHandlerJson
-
-
Method Details
-
isDebugMode
public final boolean isDebugMode()- Returns:
trueif debug mode is enabled,falseif not.- Since:
- 8.8.2
-
setDebugMode
Enable or disable debug mode on demand.- Parameters:
bDebugMode-trueto enable debug mode,falseto disable it.- Returns:
- this for chaining
- Since:
- 9.6.3
-
getFallbackCharset
- Returns:
- The fallback charset to be used, in case no charset can be determined from the content.
By default this is the HTTP default charset. Never
null. - Since:
- 9.6.3
-
setFallbackCharset
Set the fallback charset to be used, if the payload has no charset.- Parameters:
aFallbackCharset- The fallback charset to be used. May not benull.- Returns:
- this for chaining
- Since:
- 9.6.3
-
handleResponse
@Nullable public T handleResponse(@Nonnull org.apache.hc.core5.http.ClassicHttpResponse aHttpResponse) throws IOException - Specified by:
handleResponsein interfaceorg.apache.hc.core5.http.io.HttpClientResponseHandler<T extends com.helger.json.IJson>- Throws:
IOException
-