Jan 17th, 2013, 04:25 PM
Response - Network Interface
I was unsure if this is a good place to post this. In fact, it may be that this deserves to be asked in a Tomcat forum, rather than Spring. In any case:
I have a Spring-based web application (Spring 3.0, Spring-ws 2.0) running inside of Tomcat 7 in a Windows Server 2008 environment. I am using the MessageDispatcherServlet to map incoming requests on http://server/ws to my application.
Recently, a new requirement for communicating with legacy applications has caused us to configure the server with 2 different network interfaces with IPs "10.0.0.20" and "10.0.0.21". Tomcat is set to listen on all interfaces, so the web application has no problem responding perfectly to requests made to either address.
HOWEVER, it seems that with these legacy applications, it is necessary that my web app responds to their requests from the specific interface. In other words, if legacy app A makes a web service request to my application at "10.0.0.21", I need to make sure that the response gets sent back to legacy app A from "10.0.0.21". Right now, Windows either chooses a random interface, or whatever is defined in the routing tables as the preferred interface for these outbound calls. Consequently, sometimes it works, sometimes it doesn't.
I have taken a look a the MessageDispatcherServlet class, as well as others, hoping to find some point in the chain that I can subclass to force the web service to respond over a particular interface depending on the initial request, but it seems that it does not go low-level enough, presumably depending on Tomcat/Java to take care of it.
Is there a configuration in Spring that I can use to accomplish this?
Jan 22nd, 2013, 01:29 AM
it seems to me that will need to be configured on your servers. Your application is responding to the requests correctly and to me this is where Spring's work gets completed.
However, just a thought why can't you use the ip directly from the legacy app, i.e
Tags for this Thread