We are running our server application in Tomcat6. We want to get a web service from different server using java.net.HttpURLConnection. Also, we want to get this web service as remote-user i.e user who sent the request from browser. In other words, we want to get a web service as client user on a server running in java. Could you suggest if there are any ways to achieve this in java?
[Browser] -> [Server1] -> [Server2]
Our requirement is we want to get a service from 'Server2' through 'Server1' but 'Server1' should get the service by impersonating 'remote user' or using remote user credentials. Could you let me know if this is possible to do in java?
There are two ways.
1. Set the system properties http.proxyHost and http.proxyPort in the server 1 JVM.
2. Use java.net.URL.openConnection(java.net.Proxy) with a suitable defined java.net.Proxy object.