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: Fri, 03 Apr 2009 16:54:53 -0400

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) {
>> ...
>> }
>>
>> This is my first POST method. Here is what the LoggingFilter output
>> looks like:
>
> I misspoke. I had recently done an update method that the last long
> thread was about.
> The new method needs to be a PUT method. Please ignore this post until
> I dig further.
> Thanks.
>
>>
>> 2 * In-bound request received
>> 2 > POST http://localhost:8888/rest/create?format=application/json
>> 2 > accept-encoding: gzip,deflate
>> 2 > connection: keep-alive
>> 2 > accept-charset: UTF-8,*
>> 2 > pragma: no-cache
>> 2 > content-type: application/x-www-form-urlencoded; charset=UTF-8
>> 2 > keep-alive: 300
>> 2 > content-length: 88
>> 2 > cache-control: no-cache
>> 2 > host: localhost:8888
>> 2 > accept-language: en-us,en;q=0.5
>> 2 > user-agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US;
>> rv:1.7.12) Gecko/20050920
>> 2 > accept:
>> text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
>>
>> 2 >
>>
>> Any idea what I am doing wrong? Thanks for any help.
>>
>
>
I changed my new "create" method to use HTTP POST and be otherwise as
much the same as my working "update" method that was the subject of the
"Unmarshalling JAXB Object from JSON" thread.

I am still getting the Tomcat error and am stumped because I cannot see
much difference between the working 'update' method and the not working
'create' method.

Any ideas on this error would be greatly appreciated. Thanks.

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