Package com.helger.phase4.incoming
Class AS4IncomingMessageMetadata
java.lang.Object
com.helger.phase4.incoming.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
ConstructorsModifierConstructorDescriptionprotectedAS4IncomingMessageMetadata(@NonNull EAS4MessageMode eMode) Default constructor using a UUID as the incoming unique ID and the current date time.protectedAS4IncomingMessageMetadata(@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. -
Method Summary
Modifier and TypeMethodDescription@NonNull com.helger.collection.commons.ICommonsList<jakarta.servlet.http.Cookie> cookies()static @NonNull AS4IncomingMessageMetadatastatic @NonNull AS4IncomingMessageMetadatacreateForResponse(@NonNull @Nonempty String sRequestMessageID) static @NonNull @Nonempty String@NonNull com.helger.http.header.HttpHeaderMapfinal @NonNull OffsetDateTimefinal @NonNull @Nonempty Stringfinal @NonNull EAS4MessageModegetMode()@Nullable StringReturns the Internet Protocol (IP) address of the client or last proxy that sent the request.@Nullable StringReturns 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.@Nullable StringReturns the login of the user making this request, if the user has been authenticated, ornullif the user has not been authenticated.@Nullable Stringintboolean@Nullable com.helger.collection.commons.ICommonsList<X509Certificate> Returns the TLS certificates presented by the remote client to authenticate itself.@Nullable com.helger.collection.commons.ICommonsList<X509Certificate> Returns the TLS certificates presented by the remote peer to authenticate itself.@NonNull AS4IncomingMessageMetadatasetCookies(@Nullable jakarta.servlet.http.Cookie[] aCookies) Set the cookies to be used.@NonNull AS4IncomingMessageMetadatasetHttpHeaders(@Nullable com.helger.http.header.HttpHeaderMap aHttpHeaderMap) @NonNull AS4IncomingMessageMetadatasetIncomingUniqueID(@NonNull @Nonempty String sIncomingUniqueID) Set the incoming unique ID to be used.@NonNull AS4IncomingMessageMetadatasetRemoteAddr(@Nullable String sRemoteAddr) Set the remote address to be used.@NonNull AS4IncomingMessageMetadatasetRemoteHost(@Nullable String sRemoteHost) Set the remote host to be used.@NonNull AS4IncomingMessageMetadatasetRemotePort(int nRemotePort) Set the remote port to be used.@NonNull AS4IncomingMessageMetadatasetRemoteTlsCerts(@Nullable X509Certificate[] aRemoteTlsCerts) Deprecated, for removal: This API element is subject to removal in a future version.@NonNull AS4IncomingMessageMetadatasetRemoteTlsClientCerts(@Nullable X509Certificate[] aRemoteTlsCerts) Set the remote TLS certificates to be used.@NonNull AS4IncomingMessageMetadatasetRemoteTlsPeerCerts(@Nullable com.helger.collection.commons.ICommonsList<X509Certificate> aRemoteTlsPeerCerts) Set the remote TLS certificates to be used.@NonNull AS4IncomingMessageMetadatasetRemoteUser(@Nullable String sRemoteUser) Set the remote user to be used.@NonNull AS4IncomingMessageMetadatasetRequestMessageID(@Nullable String sRequestMessageID) Set the request AS4 message ID to be used.@NonNull AS4IncomingMessageMetadatasetResponseHttpStatusCode(int nHttpStatusCode) Set the response HTTP Status code 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.incoming.IAS4IncomingMessageMetadata
getAllCookies, hasRemoteAddr, hasRemoteHost, hasRemotePort, hasRemoteTlsCerts, hasRemoteTlsClientCerts, hasRemoteTlsPeerCerts, hasRemoteUser, remoteTlsCerts
-
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.- See Also:
-
AS4IncomingMessageMetadata
protected AS4IncomingMessageMetadata(@Nonempty @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
-
createNewIncomingUniqueID
- Returns:
- A new unique incoming ID. Neither
nullnor empty. - Since:
- 4.2.5
-
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.
-
setIncomingUniqueID
public @NonNull AS4IncomingMessageMetadata setIncomingUniqueID(@Nonempty @NonNull @Nonempty String sIncomingUniqueID) Set the incoming unique ID to be used.- Parameters:
sIncomingUniqueID- The incoming unique ID to use. May neither benullnor empty.- Returns:
- this for chaining
- Since:
- 4.2.5
-
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
@CheckForSigned public int 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
-
remoteTlsClientCerts
@ReturnsMutableObject public @Nullable com.helger.collection.commons.ICommonsList<X509Certificate> remoteTlsClientCerts()Description copied from interface:IAS4IncomingMessageMetadataReturns the TLS certificates presented by the remote client to authenticate itself.- Specified by:
remoteTlsClientCertsin interfaceIAS4IncomingMessageMetadata- Returns:
- A list containing a chain of X509Certificate objects. Maybe
null.
-
setRemoteTlsCerts
@Deprecated(forRemoval=true, since="4.5.1") public @NonNull AS4IncomingMessageMetadata setRemoteTlsCerts(@Nullable X509Certificate[] aRemoteTlsCerts) Deprecated, for removal: This API element is subject to removal in a future version.UsesetRemoteTlsClientCerts(X509Certificate[])insteadSet 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
-
setRemoteTlsClientCerts
public @NonNull AS4IncomingMessageMetadata setRemoteTlsClientCerts(@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
-
remoteTlsPeerCerts
@ReturnsMutableObject public @Nullable com.helger.collection.commons.ICommonsList<X509Certificate> remoteTlsPeerCerts()Description copied from interface:IAS4IncomingMessageMetadataReturns the TLS certificates presented by the remote peer to authenticate itself.- Specified by:
remoteTlsPeerCertsin interfaceIAS4IncomingMessageMetadata- Returns:
- A list containing a chain of X509Certificate objects. Maybe
null.
-
setRemoteTlsPeerCerts
public @NonNull AS4IncomingMessageMetadata setRemoteTlsPeerCerts(@Nullable com.helger.collection.commons.ICommonsList<X509Certificate> aRemoteTlsPeerCerts) Set the remote TLS certificates to be used.- Parameters:
aRemoteTlsPeerCerts- The TLS certificates the remote peer presented during the handshake. May benull.- Returns:
- this for chaining
- Since:
- 4.5.1
-
cookies
@ReturnsMutableObject public @NonNull com.helger.collection.commons.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
public @NonNull 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
@ReturnsMutableCopy public @NonNull com.helger.http.header.HttpHeaderMap getAllHttpHeaders()- Specified by:
getAllHttpHeadersin interfaceIAS4IncomingMessageMetadata- Returns:
- A copy of all the HTTP headers from the incoming request. Never
nullbut maybe empty.
-
setHttpHeaders
public @NonNull AS4IncomingMessageMetadata setHttpHeaders(@Nullable com.helger.http.header.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
-
getResponseHttpStatusCode
@CheckForSigned public int getResponseHttpStatusCode()- Specified by:
getResponseHttpStatusCodein interfaceIAS4IncomingMessageMetadata- Returns:
- The HTTP status code to be returned. All values ≤ 0 means: undefined.
-
hasResponseHttpStatusCode
public boolean hasResponseHttpStatusCode()- Specified by:
hasResponseHttpStatusCodein interfaceIAS4IncomingMessageMetadata- Returns:
trueif a defined HTTP status code is present,falseotherwise.
-
setResponseHttpStatusCode
Set the response HTTP Status code to be used. This is only called for RESPONSE mode messages.- Parameters:
nHttpStatusCode- The HTTP status code to be used. Any value ≤ 0 means to use the default.- Returns:
- this for chaining
- Since:
- 4.2.0
-
toString
-
createForRequest
-
createForResponse
public static @NonNull AS4IncomingMessageMetadata createForResponse(@Nonempty @NonNull @Nonempty String sRequestMessageID)
-
setRemoteTlsClientCerts(X509Certificate[])instead