我使用Spring集成進行Web服務消息處理。不幸的是,該消息不包含發件人IP地址。我如何獲得這些信息?如何在春季集成中獲取發件人IP地址?
@Bean
public SimpleWebServiceInboundGateway myInboundGateway() {
SimpleWebServiceInboundGateway simpleWebServiceInboundGateway = new SimpleWebServiceInboundGateway();
simpleWebServiceInboundGateway.setRequestChannelName("testChannel");
simpleWebServiceInboundGateway.setReplyChannelName("testResponseChannel");
return simpleWebServiceInboundGateway;
}
@ServiceActivator(inputChannel = "testChannel", outputChannel = "testResponseChannel")
public Message getHeaders(Message message) {
// how can I reach the sender IP address here
return message;
}
可能與[此線程]重複(http://stackoverflow.com/questions/10363069/how-can-i-retrieve-ip-address-from-http-header-in-java) –