I am developing a servlet that gets the name of a web service and can redirect a request to an external web service, for example: http://www.webservice.com/...
I am creating a response wrapper that intercepts the response, but I cannot redirect the request to an external web service, it only works if I redirect the request to a servlet located on the same server.
Example:
request.getRequestDispatcher("aMyServlet").forward(request, response) // WORKS request.getRequestDispatcher("http://www.webservice.com/...").forward(request, response)
Not because Tomcat is looking for http://www.webservice.com/... on the server as a local resource.
How can I execute an external request?
thanks
java servlets forward
pAkY88
source share