有什麼方法可以將請求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頁面?