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
Abstract HTTP based sender module
- Author:
- Philip Helger
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringAttribute name for connection timeout in millisecondsstatic final StringAttribute name for quoting header values (boolean)static final StringAttribute name for read timeout in millisecondsstatic final org.apache.hc.core5.util.TimeoutDefault connection timeout: 60 secondsstatic final booleanDefault quote header values: falsestatic final org.apache.hc.core5.util.TimeoutDefault read timeout: 60 secondsFields inherited from class com.helger.as2lib.AbstractDynamicComponent
m_aRWLockFields inherited from interface com.helger.as2lib.processor.sender.IProcessorSenderModule
DO_SEND, DO_SEND_ASYNC_MDN -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the hostname verifier to be used.Create theSSLContextto be used for https connections.final org.apache.hc.core5.util.Timeoutfinal IHTTPIncomingDumperGet the customized incoming dumper, falling back to the global incoming dumper if no specific dumper is set.getHttpClient(String sUrl, com.helger.commons.http.EHttpMethod eRequestMethod, Proxy aProxy) Generate a HttpClient connection.final IHTTPIncomingDumperfinal IHTTPOutgoingDumperfinal IAS2OutgoingHttpCallbackfinal org.apache.hc.core5.util.Timeoutfinal booleanbooleanDetermine, if the SSL/TLS context should be used or not.final voidsetConnectTimeoutMilliseconds(long nMS) final voidsetHttpIncomingDumper(IHTTPIncomingDumper aHttpIncomingDumper) Set the specific incoming dumper of this receiver.final voidsetHttpOutgoingDumperFactory(IHTTPOutgoingDumperFactory aHttpOutgoingDumperFactory) final voidSet the http communication callback that is invoked with the most crucial data elements for easy logging.final voidsetQuoteHeaderValues(boolean bQuoteHeaderValues) final voidsetResponseTimeoutMilliseconds(long nMS) Methods inherited from class com.helger.as2lib.processor.sender.AbstractSenderModule
doResend, getRetryCountMethods inherited from class com.helger.as2lib.AbstractDynamicComponent
attrs, equals, getAttributeAsIntRequired, getAttributeAsStringRequired, getName, getSession, hashCode, initDynamicComponent, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.helger.as2lib.IDynamicComponent
attrs, getName, getSession, initDynamicComponentMethods inherited from interface com.helger.as2lib.processor.module.IProcessorModule
canHandle, handle
-
Field Details
-
ATTR_CONNECT_TIMEOUT
Attribute name for connection timeout in milliseconds- See Also:
-
ATTR_RESPONSE_TIMEOUT
Attribute name for read timeout in milliseconds- See Also:
-
ATTR_QUOTE_HEADER_VALUES
Attribute name for quoting header values (boolean)- See Also:
-
DEFAULT_CONNECT_TIMEOUT
public static final org.apache.hc.core5.util.Timeout DEFAULT_CONNECT_TIMEOUTDefault connection timeout: 60 seconds -
DEFAULT_RESPONSE_TIMEOUT
public static final org.apache.hc.core5.util.Timeout DEFAULT_RESPONSE_TIMEOUTDefault read timeout: 60 seconds -
DEFAULT_QUOTE_HEADER_VALUES
public static final boolean DEFAULT_QUOTE_HEADER_VALUESDefault quote header values: false- See Also:
-
-
Constructor Details
-
AbstractHttpSenderModule
protected AbstractHttpSenderModule()
-
-
Method Details
-
getHttpOutgoingDumperFactory
-
getHttpOutgoingDumper
-
setHttpOutgoingDumperFactory
public final void setHttpOutgoingDumperFactory(@Nullable IHTTPOutgoingDumperFactory aHttpOutgoingDumperFactory) -
getHttpIncomingDumper
- Returns:
- The specific incoming dumper of this receiver. May be
null. - Since:
- v4.4.5
-
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
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
- Returns:
- The outgoing HTTP callback object. May be
null. - Since:
- 4.7.1
-
setOutgoingHttpCallback
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
-
setConnectTimeoutMilliseconds
public final void setConnectTimeoutMilliseconds(long nMS) -
getResponseTimeout
-
setResponseTimeoutMilliseconds
public final void setResponseTimeoutMilliseconds(long nMS) -
isQuoteHeaderValues
public final boolean isQuoteHeaderValues() -
setQuoteHeaderValues
public final void setQuoteHeaderValues(boolean bQuoteHeaderValues) -
createSSLContext
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
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
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
-