We are using JBoss 5.1 with Guice 3.0 and need to forward from our Guice servlet to an external Servlet using the following technique:
@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);
}
On several of our dev servers this forwards to the corrrect url (e.g. localhost/ourApp/ExternalServlet) but on our production staging server it is prepending /get/1234 so the url is forwarding to localhost/ourApp/get/1234/ExternalServlet. A redirect works.
Any idea why the forward is prepending the Guice servlet? Thanks.