users@jersey.java.net

Re: [Jersey] Error: Request entity is in a format not supported by the requested resource for the requested method

From: Farrukh Najmi <farrukh_at_wellfleetsoftware.com>
Date: Sat, 04 Apr 2009 09:02:30 -0400

Thanks Marc. You were spot on. Thanks again.

Marc Hadley wrote:
> One issue I can see is that the method is marked with
> @Consumes({"application/xml","application/json"}) but the body of the
> POST is application/x-www-form-urlencoded. You either need to change
> the @Consumes to match the POST media type or change the client to
> send the correct format.
>
> Marc.
>
> On Apr 3, 2009, at 4:54 PM, Farrukh Najmi wrote:
>
>> Farrukh Najmi wrote:
>>> Farrukh Najmi wrote:
>>>> Hi Guys,
>>>>
>>>> This one is surely something really dumb that I am doing wrong...
>>>>
>>>> I am just starting to add the create method for my resource. The
>>>> create RPC never makes it into my jersey annotated create method.
>>>> Instead Tomcat valve code seem to be returning the following error:
>>>>
>>>> "The server refused this request because the request entity is in a
>>>> format not supported by the requested resource for the requested
>>>> method"
>>>>
>>>> I do not see a stacktrace anywhere.
>>>>
>>>> Here is what my new method looks like:
>>>>
>>>> @Path("/create")
>>>> @POST
>>>> @Produces({"application/xml","application/json"})
>>>> @Consumes({"application/xml","application/json"})
>>>> public Response create(@FormParam("xsiType") String xsiType,
>>>> @QueryParam("format") String format,
>>>> MultivaluedMap<String, String> formParamsMulti) {
>>>> ...
>>>> }
>>>>


-- 
Regards,
Farrukh
Web: http://www.wellfleetsoftware.com