users@jersey.java.net

[Jersey] [Solved] Re: Json (proxying) help

From: Pierre Radermecker <pradermecker_at_yahoo.ca>
Date: Mon, 10 Oct 2011 11:49:43 -0700 (PDT)

________________________________

> I don't know how I could just pass the "jsonInput" to the URL without even
> serializing it.


Thanks Tatu, I did modify the service like this:
 
    @PUT
    @Path("gml")
    @Consumes("application/json")
    public Response myMethod(final @QueryParam("oneId") Integer oneId, InputStream theInput) throws IOException {

        ClientResponse gmlResponse;
        try {
            gmlResponse = client.resource(gmlUrl)
                    .accept("application/gml+xml")
                    .type(MediaType.APPLICATION_JSON_TYPE)
                    .entity(ByteStreams.toByteArray(theInput))
                    .get(ClientResponse.class);
        } finally {
            Closeables.closeQuietly(mapInput);


It looks like it works fine. The Input is never big so I guess it is just OK to use a plain byte copy.


Regards