Package com.helger.phase4.servlet
Class AS4IncomingMessageMetadata
java.lang.Object
com.helger.phase4.servlet.AS4IncomingMessageMetadata
- All Implemented Interfaces:
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 Summary
ConstructorsModifierConstructorDescriptionprotectedDefault constructor using a UUID as the incoming unique ID and the current date time.protectedAS4IncomingMessageMetadata(String sIncomingUniqueID, OffsetDateTime aIncomingDT, EAS4MessageMode eMode) Constructor in case this every needs to be deserialized or other weird things are necessary. -
Method Summary
Modifier and TypeMethodDescriptioncom.helger.commons.collection.impl.ICommonsList<jakarta.servlet.http.Cookie>cookies()static AS4IncomingMessageMetadatastatic AS4IncomingMessageMetadatacreateForResponse(String sRequestMessageID) com.helger.commons.http.HttpHeaderMapfinal OffsetDateTimefinal Stringfinal EAS4MessageModegetMode()Returns the Internet Protocol (IP) address of the client or last proxy that sent the request.Returns the fully qualified name of the client or the last proxy that sent the request.intReturns the Internet Protocol (IP) source port of the client or last proxy that sent the request.Returns the login of the user making this request, if the user has been authenticated, ornullif the user has not been authenticated.com.helger.commons.collection.impl.ICommonsList<X509Certificate>Returns the TLS certificates presented by the remote client to authenticate itself.setCookies(jakarta.servlet.http.Cookie[] aCookies) Set the cookies to be used.setHttpHeaders(com.helger.commons.http.HttpHeaderMap aHttpHeaderMap) setRemoteAddr(String sRemoteAddr) Set the remote address to be used.setRemoteHost(String sRemoteHost) Set the remote host to be used.setRemotePort(int nRemotePort) Set the remote port to be used.setRemoteTlsCerts(X509Certificate[] aRemoteTlsCerts) Set the remote TLS certificates to be used.setRemoteUser(String sRemoteUser) Set the remote user to be used.setRequestMessageID(String sRequestMessageID) Set the request AS4 message ID to be used.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.helger.phase4.messaging.IAS4IncomingMessageMetadata
getAllCookies, hasRemoteAddr, hasRemoteHost, hasRemotePort, hasRemoteTlsCerts, hasRemoteUser
-
Constructor Details
-
AS4IncomingMessageMetadata
Default constructor using a UUID as the incoming unique ID and the current date time.- Parameters:
eMode- The messaging mode. May not benull.
-
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 benullnor empty.aIncomingDT- The incoming date time. May not benull.eMode- The messaging mode. May not benull.
-
-
Method Details
-
getIncomingUniqueID
- Specified by:
getIncomingUniqueIDin interfaceIAS4IncomingMessageMetadata- 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
nullnor empty.
-
getIncomingDT
- Specified by:
getIncomingDTin interfaceIAS4IncomingMessageMetadata- Returns:
- The date and time when the request was received. Never
null.
-
getMode
- Specified by:
getModein interfaceIAS4IncomingMessageMetadata- Returns:
- The message mode. May be
null.
-
getRemoteAddr
Description copied from interface:IAS4IncomingMessageMetadataReturns the Internet Protocol (IP) address of the client or last proxy that sent the request.- Specified by:
getRemoteAddrin interfaceIAS4IncomingMessageMetadata- Returns:
- a
Stringcontaining the IP address of the client that sent the request
-
setRemoteAddr
Set the remote address to be used.- Parameters:
sRemoteAddr- The remote address. May benull.- Returns:
- this for chaining
-
getRemoteHost
Description copied from interface:IAS4IncomingMessageMetadataReturns 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:
getRemoteHostin interfaceIAS4IncomingMessageMetadata- Returns:
- a
Stringcontaining the fully qualified name of the client
-
setRemoteHost
Set the remote host to be used.- Parameters:
sRemoteHost- The remote host. May benull.- Returns:
- this for chaining
-
getRemotePort
Description copied from interface:IAS4IncomingMessageMetadataReturns the Internet Protocol (IP) source port of the client or last proxy that sent the request.- Specified by:
getRemotePortin interfaceIAS4IncomingMessageMetadata- Returns:
- an integer specifying the port number or a negative value if not set
-
setRemotePort
Set the remote port to be used.- Parameters:
nRemotePort- The remote port.- Returns:
- this for chaining
-
getRemoteUser
Description copied from interface:IAS4IncomingMessageMetadataReturns the login of the user making this request, if the user has been authenticated, ornullif 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:
getRemoteUserin interfaceIAS4IncomingMessageMetadata- Returns:
- a
Stringspecifying the login of the user making this request, ornullif the user login is not known
-
setRemoteUser
Set the remote user to be used.- Parameters:
sRemoteUser- The remote user. May benull.- Returns:
- this for chaining
-
remoteTlsCerts
@Nullable @ReturnsMutableObject public com.helger.commons.collection.impl.ICommonsList<X509Certificate> remoteTlsCerts()Description copied from interface:IAS4IncomingMessageMetadataReturns the TLS certificates presented by the remote client to authenticate itself.- Specified by:
remoteTlsCertsin interfaceIAS4IncomingMessageMetadata- 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 benull.- Returns:
- this for chaining
- Since:
- 2.5.0
-
cookies
@Nonnull @ReturnsMutableObject public com.helger.commons.collection.impl.ICommonsList<jakarta.servlet.http.Cookie> cookies()- Specified by:
cookiesin interfaceIAS4IncomingMessageMetadata- Returns:
- A list of all Cookies contained in the request. Never
nullbut 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 benull.- Returns:
- this for chaining
-
getAllHttpHeaders
- Specified by:
getAllHttpHeadersin interfaceIAS4IncomingMessageMetadata- Returns:
- A copy of all the HTTP headers from the incoming request. Never
nullbut maybe empty.
-
setHttpHeaders
@Nonnull public AS4IncomingMessageMetadata setHttpHeaders(@Nullable com.helger.commons.http.HttpHeaderMap aHttpHeaderMap) -
getRequestMessageID
- Specified by:
getRequestMessageIDin interfaceIAS4IncomingMessageMetadata- Returns:
- The AS4 message ID of the request message. This field is always
nullfor a request. This field is always non-nullfor a response. - See Also:
-
setRequestMessageID
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 methodcreateForResponse(String).- Parameters:
sRequestMessageID- The request message ID to be used. May benull.- Returns:
- this for chaining
- Since:
- 1.4.2
-
toString
-
createForRequest
-
createForResponse
@Nonnull public static AS4IncomingMessageMetadata createForResponse(@Nonnull @Nonempty String sRequestMessageID)
-