Hello, Req: Request forwarding to another REST Server
I have to forward the incoming request to another server as per some condition operation. In the preprocess Interceptor I am checking the method and the condition. I am facing issue in how to forward the request in the preprocess. Below is my view: 1) Get the http request/response and use dispatcher to forward the request HttpServletRequest servletRequest = ResteasyProviderFactory.getContextData(HttpServletRequest.class); HttpServletResponse servletResponse = ResteasyProviderFactory.getContextData(HttpServletResponse.class); servletRequest.getRequestDispatcher(urlOfSecondServer).forward(servletRequest, servletResponse); - But the "dispatcher.forward" is within the servlet context and forward to another server (running in different machine) may not work. 2) preprocess method returns ServerResponse - so dispatcher.forward may not work. As a null response from preprocess would continue the request process in the same server. And a object (ServerResponse) would return the same to the client. 3) InternalDispatcher- This can be used if the Request is to be executed (forward() or invoke()) in the same Servlet Context (same Container). 4) The other way is to create a proxyClient (using ProxyFactory.create) and send the Request to the remote REST server. Receive the Response and send it to the client. Are there any alternatives, suggestions. Is my understanding right. Could someone please help me in this. Thank you. ------------------------------------------------------------------------------ Precog is a next-generation analytics platform capable of advanced analytics on semi-structured data. The platform includes APIs for building apps and a phenomenal toolset for data science. Developers can use our toolset for easy data analysis & visualization. Get a free account! http://www2.precog.com/precogplatform/slashdotnewsletter _______________________________________________ Resteasy-users mailing list Resteasy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/resteasy-users