Class 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 Details

    • ATTR_CONNECT_TIMEOUT

      public static final String ATTR_CONNECT_TIMEOUT
      Attribute name for connection timeout in milliseconds
      See Also:
    • ATTR_RESPONSE_TIMEOUT

      public static final String ATTR_RESPONSE_TIMEOUT
      Attribute name for read timeout in milliseconds
      See Also:
    • ATTR_QUOTE_HEADER_VALUES

      public static final String 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_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:
  • Constructor Details

    • AbstractHttpSenderModule

      protected AbstractHttpSenderModule()
  • Method Details

    • 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 be null.
      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 be null.
      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 the SSLContext to 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 be null.
      Throws:
      GeneralSecurityException - If something internally goes wrong.
    • createHostnameVerifier

      @Nullable @OverrideOnDemand public HostnameVerifier createHostnameVerifier()
      Get the hostname verifier to be used. By default an instance of HostnameVerifierVerifyAll is returned. Override this method to change this default behavior.
      Returns:
      The hostname verifier to be used. If the returned value is null it 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 returns true if the URL starts with "https".
      Parameters:
      sUrl - The URL to which the request is made.
      Returns:
      true to use SSL/TLS, false if 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 to
      eRequestMethod - HTTP Request method to use. May not be null.
      aProxy - Optional proxy to use. May be null.
      Returns:
      a AS2HttpClient object to work with
      Throws:
      AS2Exception - If something goes wrong