Clone HTTP request and redirect to another server at localhost

I have a servlet which I call from an ajax function. What I want to do is forward the same request (header, cookie, etc.) to a different url on localhost. I need to call a hidden php api (not publicly accessible apache2) which I want to call using the original php session (cookies and headers).

I'm sure there is an easy way to do this, but I haven't found anything easier than doing an HttpURLConnection and populating all the data on foot. Is this really the only option?

+3
java tomcat


source to share


No one has answered this question yet

Check out similar questions:

1695
How to use java.net.URLConnection to trigger and process HTTP requests
604
Difference between Apache HTTP Server and Apache Tomcat?
249
RESTful Authentication over Spring
137
Servlet for serving static content
2
Access-Control-Allow-Origin for ajax call and HttpURLConnection
2
How do I handle a request on a page that was previously redirected by a servlet?
1
Forwarded request
0
Redirect request from servlet to .jsp fails when deployed to remote server
0
Forward the request to the servlet with jquery, which in turn gets passed to jsp?
0
How do I send a request to a server with a servlet?



All Articles
Loading...
X
Show
Funny
Dev
Pics