Not sure why but "JSONObject" now works instead of "JsonNode" as the type of jsonInput. So I can now forward the input without much trouble.
Is there a way to avoid the serialization of the jsonInput (except by using a filter or a real proxy ) ?
Where do you hook in Java/Tomcat/Jersey a simple proxy that needs to pass the request (without the query parameter), get the response back, apply some other processing before replying to the original caller ?
Thanks,
________________________________
From: Pierre Radermecker <pradermecker_at_yahoo.ca>
To: "users_at_jersey.java.net" <users_at_jersey.java.net>
Sent: Friday, October 7, 2011 9:26:10 PM
Subject: Json (proxying) help
Hi,
I would like to take a Json entity object from a request and send it back (proxying) to another URI. Then I need to take the output and go on processing the initial request.
So I have something like this:
@PUT
@Path("gml")
@Consumes("application/json")
public Response myMethod(final @QueryParam("oneId") Integer oneId, JsonNode jsonInput) {
// send just the jsonInput and get the output of the external webservice
ClientResponse clientResponse = client.resource(URL)
.accept("application/gml+xml")
.type(MediaType.APPLICATION_JSON_TYPE)
.entity(jsonInput)
.get(ClientResponse.class);
// parse the response and go on processing
...
}
I don't know how I could just pass the "jsonInput" to the URL without even serializing it.
If I do have to consume the inputSteam, then I know JsonNode (jackson) works (but JSONObject doesn't). And it seems to be the opposite when I try to send jsonInput as an entity in the client.
What is the best way to handle this ?
Thanks for your help.
Regards,
- PierreR