IP Message Headers
该模块使用以下 MessageHeader
实例:
This module uses the following MessageHeader
instances:
Header Name | IpHeaders Constant | Description |
---|---|---|
|
|
The host name from which a TCP message or UDP packet was received.
If |
|
|
The IP address from which a TCP message or UDP packet was received. |
|
|
The remote port for a UDP packet. |
ip_localInetAddress |
|
The local |
|
|
The remote IP address to which UDP application-level acknowledgments are sent. The framework includes acknowledgment information in the data packet. |
|
|
A correlation ID for UDP application-level acknowledgments. The framework includes acknowledgment information in the data packet. |
|
|
The remote port for a TCP connection. |
|
|
A unique identifier for a TCP connection. Set by the framework for inbound messages. When sending to a server-side inbound channel adapter or replying to an inbound gateway, this header is required so that the endpoint can determine the connection to which to send the message. |
|
|
For information only. When using a cached or failover client connection factory, it contains the actual underlying connection ID. |
|
|
An optional content type for inbound messages
Described after this table.
Note that, unlike the other header constants, this constant is in the |
对于入站消息,ip_hostname
、ip_address
、ip_tcp_remotePort
和 ip_connectionId
由默认的 TcpHeaderMapper
映射。如果您将映射器的 addContentTypeHeader
属性设置为 true
,则映射器会设置 contentType
头(默认为 application/octet-stream;charset="UTF-8"
)。您可以通过设置 contentType
属性来更改默认值。您可以通过对 TcpHeaderMapper
进行子类化和覆盖 supplyCustomHeaders
方法来添加其他头。例如,在您使用 SSL 时,您可以通过从 TcpConnection
对象获取会话对象来添加 SSLSession
的属性,该对象是作为 supplyCustomHeaders
方法的参数提供的。
For inbound messages, ip_hostname
, ip_address
, ip_tcp_remotePort
, and ip_connectionId
are mapped by the default TcpHeaderMapper
.
If you set the mapper’s addContentTypeHeader
property to true
, the mapper sets the contentType
header (application/octet-stream;charset="UTF-8"
, by default).
You can change the default by setting the contentType
property.
You can add additional headers by subclassing TcpHeaderMapper
and overriding the supplyCustomHeaders
method.
For example, when you use SSL, you can add properties of the SSLSession
by obtaining the session object from the TcpConnection
object, which is provided as an argument to the supplyCustomHeaders
method.
对于出站消息,String
有效负载会转换为 byte[]
,使用默认 (UTF-8
) 字符集。设置 charset
属性可更改默认设置。
For outbound messages, String
payloads are converted to byte[]
with the default (UTF-8
) charset.
Set the charset
property to change the default.
在自定义映射器属性或进行子类化时,将映射器声明为一个 bean,并通过使用 mapper
属性向连接工厂提供一个实例。
When customizing the mapper properties or subclassing, declare the mapper as a bean and provide an instance to the connection factory by using the mapper
property.