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]
(Remote user)

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?