2

I want to know is there any way to forward servlet request and response from a rest webservice to a servlet.. I have a servlet on remote server from which i am calling webservice to get the request params and then i want it to forward to another servlet from that webservice.I tried some code but it does not work. Please give me suggestions if anyone had worked on it.

this is my rest web code snippet

@GET
    @Path("/test")
    public void requestToTelkom(@Context HttpServletRequest request,@Context HttpServletResponse response ) {

         try {



        // the request object is printed successfully
        System.out.println(request);



// when i try to forward like this i get exceptions
         RequestDispatcher rd = request
                 .getRequestDispatcher("BypassServlet");

            rd.forward(request, response);
        } catch (ServletException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

I got this exception with above code

 UT010023: Request io.undertow.servlet.spec.HttpServletRequestImpl@53b21177 was not original or a wrapper
kirti
  • 4,499
  • 4
  • 31
  • 60

1 Answers1

0

For future visitors looking for a solution. This is what helped me on a jboss eap 7 server..add allow-non-standard-wrappers="true" to your standalone.xml file in the servlet container like this:

<servlet-container name="default" allow-non-standard-wrappers="true">
    <jsp-config/>
    <websockets/>
</servlet-container>
KingO
  • 11
  • 3