users@jersey.java.net

[Jersey] Re: Jersey to return a needed content type

From: Pavel Bucek <pavel.bucek_at_oracle.com>
Date: Tue, 29 Nov 2011 23:33:53 +0100

Hello Sigmar,

yes, it is possible. You can do that easily:

@Path("somepath")
public class SomeResource {
     @Consumes("multipart/form-data")
     @Produces("application/json")
     public MyTypeToBeReturnedAsJson postFile(....) {
         ...
     }
}

Regards,
Pavel

On 11/29/11 9:39 AM, Sigmar Muuga wrote:
> Hi!
>
> Is it possible to to consume contant type A and then respond with
> content type B? My problem is that when I am uploading file with
> Jersey, it will respond with multipart/form-data content type. I want
> to respond with application/json or text/plain instead.
>
> Did not find anything like this from the docs too :(
>
> Sigmar