Package com.adaptris.core.http.apache5
Class DefaultClientBuilder
- java.lang.Object
-
- com.adaptris.core.http.apache5.DefaultClientBuilder
-
- All Implemented Interfaces:
HttpClientBuilderConfigurator
public class DefaultClientBuilder extends java.lang.Object implements HttpClientBuilderConfigurator
defaultHttpClientBuilderConfiguratorinstanceIn the adapter configuration file this class is aliased as default-apache-http-client-builder which is the preferred alternative to the fully qualified classname when building your configuration.
-
-
Constructor Summary
Constructors Constructor Description DefaultClientBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.hc.client5.http.impl.classic.HttpClientBuilderconfigure(org.apache.hc.client5.http.impl.classic.HttpClientBuilder builder)Do any additional configuration.org.apache.hc.client5.http.impl.classic.HttpClientBuilderconfigure(org.apache.hc.client5.http.impl.classic.HttpClientBuilder builder, long timeout)Do any additional configuration.protected org.apache.hc.client5.http.impl.classic.HttpClientBuildercustomiseTimeouts(org.apache.hc.client5.http.impl.classic.HttpClientBuilder builder, long timeout)Customise any timeouts as required.java.lang.BooleangetAllowRedirect()Get the handle redirection flag.TimeIntervalgetConnectTimeout()java.lang.StringgetHttpProxy()TimeIntervalgetReadTimeout()protected booleanhandleRedirection()voidsetAllowRedirect(java.lang.Boolean b)Specify whether to automatically handle redirection.voidsetConnectTimeout(TimeInterval t)Set the connect timeout.voidsetHttpProxy(java.lang.String proxy)Explicitly configure a proxy server.voidsetReadTimeout(TimeInterval t)Set the read timeout.<T extends DefaultClientBuilder>
TwithAllowRedirect(java.lang.Boolean b)<T extends DefaultClientBuilder>
TwithConnectTimeout(TimeInterval b)<T extends DefaultClientBuilder>
TwithProxy(java.lang.String b)<T extends DefaultClientBuilder>
TwithReadTimeout(TimeInterval b)
-
-
-
Method Detail
-
configure
public org.apache.hc.client5.http.impl.classic.HttpClientBuilder configure(org.apache.hc.client5.http.impl.classic.HttpClientBuilder builder, long timeout) throws java.lang.ExceptionDescription copied from interface:HttpClientBuilderConfiguratorDo any additional configuration.This is provided as a default method, override as required.
- Specified by:
configurein interfaceHttpClientBuilderConfigurator- Parameters:
builder- the existing buildertimeout- the timeout for read operations (provided fromAdaptrisMessageProducer.request(com.adaptris.core.AdaptrisMessage, long).- Returns:
- a reconfigured builder.
- Throws:
java.lang.Exception
-
configure
public org.apache.hc.client5.http.impl.classic.HttpClientBuilder configure(org.apache.hc.client5.http.impl.classic.HttpClientBuilder builder) throws java.lang.ExceptionDescription copied from interface:HttpClientBuilderConfiguratorDo any additional configuration.- Specified by:
configurein interfaceHttpClientBuilderConfigurator- Parameters:
builder- the existing builder- Returns:
- a reconfigured builder.
- Throws:
java.lang.Exception
-
customiseTimeouts
protected org.apache.hc.client5.http.impl.classic.HttpClientBuilder customiseTimeouts(org.apache.hc.client5.http.impl.classic.HttpClientBuilder builder, long timeout)Customise any timeouts as required.- Parameters:
builder- the buildertimeout- the timeout specified byRequestReplyProducerImp.doRequest(AdaptrisMessage, String, long)- Returns:
- the builder.
-
setAllowRedirect
public void setAllowRedirect(java.lang.Boolean b)
Specify whether to automatically handle redirection.- Parameters:
b- true or false.
-
handleRedirection
protected boolean handleRedirection()
-
getAllowRedirect
public java.lang.Boolean getAllowRedirect()
Get the handle redirection flag.- Returns:
- true or false.
-
withAllowRedirect
public <T extends DefaultClientBuilder> T withAllowRedirect(java.lang.Boolean b)
-
getHttpProxy
public java.lang.String getHttpProxy()
- Returns:
- the httpProxy
-
setHttpProxy
public void setHttpProxy(java.lang.String proxy)
Explicitly configure a proxy server.- Parameters:
proxy- the httpProxy to generallyscheme://host:portor more simplyhost:port
-
withProxy
public <T extends DefaultClientBuilder> T withProxy(java.lang.String b)
-
getConnectTimeout
public TimeInterval getConnectTimeout()
-
setConnectTimeout
public void setConnectTimeout(TimeInterval t)
Set the connect timeout.- Parameters:
t- the timeout.
-
withConnectTimeout
public <T extends DefaultClientBuilder> T withConnectTimeout(TimeInterval b)
-
getReadTimeout
public TimeInterval getReadTimeout()
-
setReadTimeout
public void setReadTimeout(TimeInterval t)
Set the read timeout.Note that any read timeout will be overridden by the timeout value passed in via the {
AdaptrisMessageProducer.request(AdaptrisMessage, long)method, provided it differs fromRequestReplyProducerBase.defaultTimeout(). Apache HTTP calls this the socket timeout in their documentation.- Parameters:
t- the timeout.
-
withReadTimeout
public <T extends DefaultClientBuilder> T withReadTimeout(TimeInterval b)
-
-