Class AbstractHttpSenderModule
- java.lang.Object
-
- com.helger.as2lib.AbstractDynamicComponent
-
- com.helger.as2lib.processor.module.AbstractProcessorModule
-
- com.helger.as2lib.processor.sender.AbstractSenderModule
-
- com.helger.as2lib.processor.sender.AbstractHttpSenderModule
-
- All Implemented Interfaces:
IDynamicComponent,IProcessorModule,IProcessorSenderModule
- Direct Known Subclasses:
AS2SenderModule,AsynchMDNSenderModule
public abstract class AbstractHttpSenderModule extends AbstractSenderModule
Abstract HTTP based sender module- Author:
- Philip Helger
-
-
Field Summary
Fields Modifier and Type Field Description static StringATTR_CONNECT_TIMEOUTAttribute name for connection timeout in millisecondsstatic StringATTR_QUOTE_HEADER_VALUESAttribute name for quoting header values (boolean)static StringATTR_RESPONSE_TIMEOUTAttribute name for read timeout in millisecondsstatic org.apache.hc.core5.util.TimeoutDEFAULT_CONNECT_TIMEOUTDefault connection timeout: 60 secondsstatic booleanDEFAULT_QUOTE_HEADER_VALUESDefault quote header values: falsestatic org.apache.hc.core5.util.TimeoutDEFAULT_RESPONSE_TIMEOUTDefault read timeout: 60 seconds-
Fields inherited from class com.helger.as2lib.AbstractDynamicComponent
m_aRWLock
-
Fields inherited from interface com.helger.as2lib.processor.sender.IProcessorSenderModule
DO_SEND, DO_SEND_ASYNC_MDN
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractHttpSenderModule()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HostnameVerifiercreateHostnameVerifier()Get the hostname verifier to be used.SSLContextcreateSSLContext()Create theSSLContextto be used for https connections.org.apache.hc.core5.util.TimeoutgetConnectTimeout()IHTTPIncomingDumpergetEffectiveHttpIncomingDumper()Get the customized incoming dumper, falling back to the global incoming dumper if no specific dumper is set.AS2HttpClientgetHttpClient(String sUrl, com.helger.commons.http.EHttpMethod eRequestMethod, Proxy aProxy)Generate a HttpClient connection.IHTTPIncomingDumpergetHttpIncomingDumper()IHTTPOutgoingDumpergetHttpOutgoingDumper(IBaseMessage aMsg)IHTTPOutgoingDumperFactorygetHttpOutgoingDumperFactory()IAS2OutgoingHttpCallbackgetOutgoingHttpCallback()org.apache.hc.core5.util.TimeoutgetResponseTimeout()booleanisQuoteHeaderValues()booleanisUseSSL(String sUrl)Determine, if the SSL/TLS context should be used or not.voidsetConnectTimeoutMilliseconds(long nMS)voidsetHttpIncomingDumper(IHTTPIncomingDumper aHttpIncomingDumper)Set the specific incoming dumper of this receiver.voidsetHttpOutgoingDumperFactory(IHTTPOutgoingDumperFactory aHttpOutgoingDumperFactory)voidsetOutgoingHttpCallback(IAS2OutgoingHttpCallback aRCC)Set the http communication callback that is invoked with the most crucial data elements for easy logging.voidsetQuoteHeaderValues(boolean bQuoteHeaderValues)voidsetResponseTimeoutMilliseconds(long nMS)-
Methods inherited from class com.helger.as2lib.processor.sender.AbstractSenderModule
doResend, getRetryCount
-
Methods inherited from class com.helger.as2lib.AbstractDynamicComponent
attrs, equals, getAttributeAsIntRequired, getAttributeAsStringRequired, getName, getSession, hashCode, initDynamicComponent, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.helger.as2lib.IDynamicComponent
attrs, getName, getSession, initDynamicComponent
-
Methods inherited from interface com.helger.as2lib.processor.module.IProcessorModule
canHandle, handle
-
-
-
-
Field Detail
-
ATTR_CONNECT_TIMEOUT
public static final String ATTR_CONNECT_TIMEOUT
Attribute name for connection timeout in milliseconds- See Also:
- Constant Field Values
-
ATTR_RESPONSE_TIMEOUT
public static final String ATTR_RESPONSE_TIMEOUT
Attribute name for read timeout in milliseconds- See Also:
- Constant Field Values
-
ATTR_QUOTE_HEADER_VALUES
public static final String ATTR_QUOTE_HEADER_VALUES
Attribute name for quoting header values (boolean)- See Also:
- Constant Field Values
-
DEFAULT_CONNECT_TIMEOUT
public static final org.apache.hc.core5.util.Timeout DEFAULT_CONNECT_TIMEOUT
Default connection timeout: 60 seconds
-
DEFAULT_RESPONSE_TIMEOUT
public static final org.apache.hc.core5.util.Timeout DEFAULT_RESPONSE_TIMEOUT
Default read timeout: 60 seconds
-
DEFAULT_QUOTE_HEADER_VALUES
public static final boolean DEFAULT_QUOTE_HEADER_VALUES
Default quote header values: false- See Also:
- Constant Field Values
-
-
Method Detail
-
getHttpOutgoingDumperFactory
@Nullable public final IHTTPOutgoingDumperFactory getHttpOutgoingDumperFactory()
-
getHttpOutgoingDumper
@Nullable public final IHTTPOutgoingDumper getHttpOutgoingDumper(@Nonnull IBaseMessage aMsg)
-
setHttpOutgoingDumperFactory
public final void setHttpOutgoingDumperFactory(@Nullable IHTTPOutgoingDumperFactory aHttpOutgoingDumperFactory)
-
getHttpIncomingDumper
@Nullable public final IHTTPIncomingDumper getHttpIncomingDumper()
- Returns:
- The specific incoming dumper of this receiver. May be
null. - Since:
- v4.4.5
-
getEffectiveHttpIncomingDumper
@Nullable public final IHTTPIncomingDumper getEffectiveHttpIncomingDumper()
Get the customized incoming dumper, falling back to the global incoming dumper if no specific dumper is set.- Returns:
- The effective incoming dumper. May be
null. - Since:
- v4.4.5
-
setHttpIncomingDumper
public final void setHttpIncomingDumper(@Nullable IHTTPIncomingDumper aHttpIncomingDumper)
Set the specific incoming dumper of this receiver. If this is set, it overrides the global dumper.- Parameters:
aHttpIncomingDumper- The specific incoming dumper to be used. May benull.- Since:
- v4.4.5
-
getOutgoingHttpCallback
@Nullable public final IAS2OutgoingHttpCallback getOutgoingHttpCallback()
- Returns:
- The outgoing HTTP callback object. May be
null. - Since:
- 4.7.1
-
setOutgoingHttpCallback
public final void setOutgoingHttpCallback(@Nullable IAS2OutgoingHttpCallback aRCC)
Set the http communication callback that is invoked with the most crucial data elements for easy logging.- Parameters:
aRCC- The callback object. May benull.- Since:
- 4.7.1
-
getConnectTimeout
@Nonnull public final org.apache.hc.core5.util.Timeout getConnectTimeout()
-
setConnectTimeoutMilliseconds
public final void setConnectTimeoutMilliseconds(long nMS)
-
getResponseTimeout
@Nonnull public final org.apache.hc.core5.util.Timeout getResponseTimeout()
-
setResponseTimeoutMilliseconds
public final void setResponseTimeoutMilliseconds(long nMS)
-
isQuoteHeaderValues
public final boolean isQuoteHeaderValues()
-
setQuoteHeaderValues
public final void setQuoteHeaderValues(boolean bQuoteHeaderValues)
-
createSSLContext
@Nonnull @OverrideOnDemand public SSLContext createSSLContext() throws GeneralSecurityException
Create theSSLContextto be used for https connections. By default the SSL context will trust all hosts and present no keys. Override this method in a subclass to customize this handling.- Returns:
- The created
SSLContext. May not benull. - Throws:
GeneralSecurityException- If something internally goes wrong.
-
createHostnameVerifier
@Nullable @OverrideOnDemand public HostnameVerifier createHostnameVerifier()
Get the hostname verifier to be used. By default an instance ofHostnameVerifierVerifyAllis returned. Override this method to change this default behavior.- Returns:
- The hostname verifier to be used. If the returned value is
nullit will not be applied to the https connection.
-
isUseSSL
@OverrideOnDemand public boolean isUseSSL(@Nonnull @Nonempty String sUrl)
Determine, if the SSL/TLS context should be used or not. By default this returnstrueif the URL starts with "https".- Parameters:
sUrl- The URL to which the request is made.- Returns:
trueto use SSL/TLS,falseif not needed.
-
getHttpClient
@Nonnull public AS2HttpClient getHttpClient(@Nonnull @Nonempty String sUrl, @Nonnull com.helger.commons.http.EHttpMethod eRequestMethod, @Nullable Proxy aProxy) throws AS2Exception
Generate a HttpClient connection. It works with streams and avoids holding whole message in memory. note that bOutput, bInput, and bUseCaches are not supported- Parameters:
sUrl- URL to connect toeRequestMethod- HTTP Request method to use. May not benull.aProxy- Optional proxy to use. May benull.- Returns:
- a
AS2HttpClientobject to work with - Throws:
AS2Exception- If something goes wrong
-
-