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?