0

So i have a web service which is exposed to customers:

@GET
    @Path("/fetchItems")
    @Produces(MediaType.APPLICATION_JSON)
    public Response fetchItems() {

        URI uri = UriBuilder.fromUri(serveraddres + "/Internal" + "fetchItems").build();
        System.out.println("Forwarding to " + uri.toString());
        ......
    }

I would like to get the request from the customer and create an internal request to other server that will serve this web request. the example above is a get request but i would have as well post request with json object which i would like to forward.

I would like to avoid the following:

Incoming req -> fetchItem service extracting JSON-> creating internal
request with JSON -> Internal processing -> Internal response with
JSON -> fetchItem service response extracting JSON -> response to
customer with the JSON

how can i forward the incoming web request from "outside" to an internal web service address ? can i do it with jersey client?

I would like to have the ability to send the response to the customer from the internal web service is possible?

USer22999299
  • 5,284
  • 9
  • 46
  • 78
  • you can forward the request to the other URL: https://stackoverflow.com/questions/6984338/how-to-forward-from-a-jax-rs-service-to-jsp – wero Aug 14 '15 at 13:00
  • @wero but then i have to pull the JSON from the request and set it as attribute – USer22999299 Aug 14 '15 at 13:18

0 Answers0