Guice 3.0 で JBoss 5.1 を使用しており、次の手法を使用して Guice サーブレットから外部サーブレットに転送する必要があります。
@Inject HttpServletRequest request;
@Inject HttpServletResponse response;
@GET
@Produces("application/octet-stream")
@Path("/get/1234")
public void fwd() throws ServletException, IOException {
String newURL = "/ExternalServlet?action=1234";
RequestDispatcher dispatcher = request.getRequestDispatcher(newURL);
dispatcher.forward(request, response);
}
開発サーバーのいくつかでは、これは正しい URL (例: localhost/ourApp/ExternalServlet) に転送されますが、本番ステージング サーバーでは /get/1234 が先頭に追加されるため、URL は localhost/ourApp/ get/1234 /ExternalServlet に転送されます。リダイレクトが機能します。
転送が Guice サーブレットの先頭に追加されている理由は何ですか? ありがとう。