Class AS4IncomingMessageMetadata

java.lang.Object
com.helger.phase4.incoming.AS4IncomingMessageMetadata
All Implemented Interfaces:
IAS4IncomingMessageMetadata

public class AS4IncomingMessageMetadata extends Object implements IAS4IncomingMessageMetadata
This class holds optional metadata for a single incoming request. This is the default implementation of IAS4IncomingMessageMetadata.
Since:
0.9.8
Author:
Philip Helger
  • Constructor Details

    • AS4IncomingMessageMetadata

      protected AS4IncomingMessageMetadata(@Nonnull EAS4MessageMode eMode)
      Default constructor using a UUID as the incoming unique ID and the current date time.
      Parameters:
      eMode - The messaging mode. May not be null.
    • AS4IncomingMessageMetadata

      protected AS4IncomingMessageMetadata(@Nonnull @Nonempty String sIncomingUniqueID, @Nonnull OffsetDateTime aIncomingDT, @Nonnull EAS4MessageMode eMode)
      Constructor in case this every needs to be deserialized or other weird things are necessary.
      Parameters:
      sIncomingUniqueID - Incoming unique ID. May neither be null nor empty.
      aIncomingDT - The incoming date time. May not be null.
      eMode - The messaging mode. May not be null.
  • Method Details

    • getIncomingUniqueID

      @Nonnull @Nonempty public final String getIncomingUniqueID()
      Specified by:
      getIncomingUniqueID in interface IAS4IncomingMessageMetadata
      Returns:
      A unique ID created just for this message metadata. It can be used to reference to this message internally. Usually this is a UUID. This is different from the AS4 message ID, because in case of a corrupted message, the AS4 message ID may be missing or misplaced. Never null nor empty.
    • getIncomingDT

      @Nonnull public final OffsetDateTime getIncomingDT()
      Specified by:
      getIncomingDT in interface IAS4IncomingMessageMetadata
      Returns:
      The date and time when the request was received. Never null.
    • getMode

      @Nonnull public final EAS4MessageMode getMode()
      Specified by:
      getMode in interface IAS4IncomingMessageMetadata
      Returns:
      The message mode. May be null.
    • getRemoteAddr

      @Nullable public String getRemoteAddr()
      Description copied from interface: IAS4IncomingMessageMetadata
      Returns the Internet Protocol (IP) address of the client or last proxy that sent the request.
      Specified by:
      getRemoteAddr in interface IAS4IncomingMessageMetadata
      Returns:
      a String containing the IP address of the client that sent the request
    • setRemoteAddr

      @Nonnull public AS4IncomingMessageMetadata setRemoteAddr(@Nullable String sRemoteAddr)
      Set the remote address to be used.
      Parameters:
      sRemoteAddr - The remote address. May be null.
      Returns:
      this for chaining
    • getRemoteHost

      @Nullable public String getRemoteHost()
      Description copied from interface: IAS4IncomingMessageMetadata
      Returns the fully qualified name of the client or the last proxy that sent the request. If the engine cannot or chooses not to resolve the hostname (to improve performance), this method returns the dotted-string form of the IP address.
      Specified by:
      getRemoteHost in interface IAS4IncomingMessageMetadata
      Returns:
      a String containing the fully qualified name of the client
    • setRemoteHost

      @Nonnull public AS4IncomingMessageMetadata setRemoteHost(@Nullable String sRemoteHost)
      Set the remote host to be used.
      Parameters:
      sRemoteHost - The remote host. May be null.
      Returns:
      this for chaining
    • getRemotePort

      @CheckForSigned public int getRemotePort()
      Description copied from interface: IAS4IncomingMessageMetadata
      Returns the Internet Protocol (IP) source port of the client or last proxy that sent the request.
      Specified by:
      getRemotePort in interface IAS4IncomingMessageMetadata
      Returns:
      an integer specifying the port number or a negative value if not set
    • setRemotePort

      @Nonnull public AS4IncomingMessageMetadata setRemotePort(int nRemotePort)
      Set the remote port to be used.
      Parameters:
      nRemotePort - The remote port.
      Returns:
      this for chaining
    • getRemoteUser

      @Nullable public String getRemoteUser()
      Description copied from interface: IAS4IncomingMessageMetadata
      Returns the login of the user making this request, if the user has been authenticated, or null if the user has not been authenticated. Whether the user name is sent with each subsequent request depends on the browser and type of authentication.
      Specified by:
      getRemoteUser in interface IAS4IncomingMessageMetadata
      Returns:
      a String specifying the login of the user making this request, or null if the user login is not known
    • setRemoteUser

      @Nonnull public AS4IncomingMessageMetadata setRemoteUser(@Nullable String sRemoteUser)
      Set the remote user to be used.
      Parameters:
      sRemoteUser - The remote user. May be null.
      Returns:
      this for chaining
    • remoteTlsCerts

      @Nullable @ReturnsMutableObject public com.helger.collection.commons.ICommonsList<X509Certificate> remoteTlsCerts()
      Description copied from interface: IAS4IncomingMessageMetadata
      Returns the TLS certificates presented by the remote client to authenticate itself.
      Specified by:
      remoteTlsCerts in interface IAS4IncomingMessageMetadata
      Returns:
      A list containing a chain of X509Certificate objects. Maybe null.
    • setRemoteTlsCerts

      @Nonnull public AS4IncomingMessageMetadata setRemoteTlsCerts(@Nullable X509Certificate[] aRemoteTlsCerts)
      Set the remote TLS certificates to be used.
      Parameters:
      aRemoteTlsCerts - The TLS certificates the remote client presented during the handshake. May be null.
      Returns:
      this for chaining
      Since:
      2.5.0
    • cookies

      @Nonnull @ReturnsMutableObject public com.helger.collection.commons.ICommonsList<jakarta.servlet.http.Cookie> cookies()
      Specified by:
      cookies in interface IAS4IncomingMessageMetadata
      Returns:
      A list of all Cookies contained in the request. Never null but maybe empty. The returned list is mutable so handle with care.
    • setCookies

      @Nonnull public AS4IncomingMessageMetadata setCookies(@Nullable jakarta.servlet.http.Cookie[] aCookies)
      Set the cookies to be used.
      Parameters:
      aCookies - The cookie array. May be null.
      Returns:
      this for chaining
    • getAllHttpHeaders

      @Nonnull @ReturnsMutableCopy public com.helger.http.header.HttpHeaderMap getAllHttpHeaders()
      Specified by:
      getAllHttpHeaders in interface IAS4IncomingMessageMetadata
      Returns:
      A copy of all the HTTP headers from the incoming request. Never null but maybe empty.
    • setHttpHeaders

      @Nonnull public AS4IncomingMessageMetadata setHttpHeaders(@Nullable com.helger.http.header.HttpHeaderMap aHttpHeaderMap)
    • getRequestMessageID

      @Nullable public String getRequestMessageID()
      Specified by:
      getRequestMessageID in interface IAS4IncomingMessageMetadata
      Returns:
      The AS4 message ID of the request message. This field is always null for a request. This field is always non-null for a response.
      See Also:
    • setRequestMessageID

      @Nonnull public AS4IncomingMessageMetadata setRequestMessageID(@Nullable String sRequestMessageID)
      Set the request AS4 message ID to be used. This field should only be set by responses. Usually you don't have to call this setter, as this is done by the factory method createForResponse(String).
      Parameters:
      sRequestMessageID - The request message ID to be used. May be null.
      Returns:
      this for chaining
      Since:
      1.4.2
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • createForRequest

      @Nonnull public static AS4IncomingMessageMetadata createForRequest()
    • createForResponse

      @Nonnull public static AS4IncomingMessageMetadata createForResponse(@Nonnull @Nonempty String sRequestMessageID)