Is there any way to change the request URL to point to another page hosted in different web server? Suppose I have a page hosted in Tomcat:
<form action="http://localhost:8080/Test/dummy.jsp" method="Post">
<input type="text" name="text"></input>
<input type="Submit" value="submit"/>
</form>
And I intercept the request using a servlet filter:
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException,ServletException {
HttpServletRequest request = (HttpServletRequest) req;
chain.doFilter(req, res);
return;
}
What I want is to change the request URL to point to a PHP page hosted in another web server http://localhost/display.php
. I know that I can use response.sendRedirect
, but it won't work in my case because it discards all POST data. Is there any way to change the request URL so that chain.doFilter(req, res);
will forward me to that PHP page?