有什么方法可以将请求URL更改为指向托管在其他Web服务器中的另一个页面?假设我有在Tomcat中托管的网页:更改请求URL以指向servlet过滤器中的不同Web服务器
<form action="http://localhost:8080/Test/dummy.jsp" method="Post">
<input type="text" name="text"></input>
<input type="Submit" value="submit"/>
</form>
我拦截使用Servlet过滤器的要求:
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException,ServletException {
HttpServletRequest request = (HttpServletRequest) req;
chain.doFilter(req, res);
return;
}
我想是改变请求的URL指向在托管的PHP页面另一个网络服务器http://localhost/display.php
。我知道我可以使用response.sendRedirect
,但它不适用于我的情况,因为它会丢弃所有POST数据。有什么方法可以更改请求URL,以便chain.doFilter(req, res);
将我转到该PHP页面?