【发布时间】:2013-04-03 10:01:21
【问题描述】:
有什么方法可以更改请求 URL 以指向托管在不同 Web 服务器中的另一个页面?假设我有一个托管在 Tomcat 中的页面:
<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 以指向托管在另一个 Web 服务器 http://localhost/display.php 中的 PHP 页面。我知道我可以使用response.sendRedirect,但在我的情况下它不起作用,因为它会丢弃所有 POST 数据。有什么方法可以更改请求 URL,以便 chain.doFilter(req, res); 将我转发到那个 PHP 页面?
【问题讨论】:
标签: php jsp redirect servlet-filters