Hi,
I have fixed in the in the trunk.
Consuming "*/*" means that a resource method can consume a request
entity identified by any media type or no media type (if the Content-
Type request header is not present).
Paul.
On Aug 8, 2009, at 1:39 PM, Paul Sandoz wrote:
> Hi,
>
> You have found an edge case when the Content-Type request header is
> absent from the request.
>
> If you performed the regular POST request with a Content-Type header
> present (with a value that is not of form urlencoded) then does it
> work for you?
>
> The absence of a Content-Type does not necessarily mean there is no
> entity (and vice versa, the presence of a Content-Type is not
> necessary mean there is an entity, see later).
>
> I think the fix would be if the Content-Type is absent then the set
> of resource methods that match are those that consume "*/*". Thus "*/
> *" declares any media type or none. Could you log an issue?
>
>
> The opposite edge cases is when content-type is present but there is
> no entity, which can occur say with WebDAV clients. For this case
> you can utilize an EntityHolder:
>
> https://jersey.dev.java.net/nonav/apidocs/1.1.1-ea/jersey/com/sun/jersey/core/provider/EntityHolder.html
>
> Paul.
>
> On Aug 7, 2009, at 10:10 PM, Jalpesh Patadia wrote:
>
>> I think this is a bug, but I just wanted to confirm before I file it.
>>
>> Here’s a sample of my code :
>>
>> /** This method should trap normal posts */
>> @Path("test1")
>> @POST
>> public void testMethod(@Context HttpServletRequest request) {
>> System.out.println("Standard method.....");
>> }
>>
>> /** Form based posts should throw an error */
>> @Path("test1")
>> @POST
>> @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
>> public void formPostParameters(@Context HttpServletRequest
>> request, MultivaluedMap<String, String> params) {
>> System.out.println("Form post methods are not
>> supported.....");
>> }
>>
>> What I’m seeing is that if I use a form based post (which has some
>> post parameters) from a browser, the second method is called and
>> the values of the form parameters are passed in correctly.
>>
>> However If I use a regular post (same url), passing in query
>> parameters instead of form post parameters, I get an error code 415
>> – Unsupported media type.
>>
>> I would assume that jersey would invoke the second method when a
>> form based post is encountered.
>> If a user did not specify a @Consumes annotation and is performing
>> a normal HTTP Post with only query parameters the first method
>> should be invoked.
>>
>> Am I missing something in understanding the spec ? If so, how would
>> I accomplish my use case ? Basically I want to find out if a user
>> has specified some form post parameters, and I can’t read them from
>> the HttpServletRequest - the only possible way to do that is to
>> use the MultivaluedMap.
>>
>>
>> Thanks,
>>
>>
>> Jalpesh
>> PRIVILEGED AND CONFIDENTIAL
>> This transmission may contain privileged, proprietary or
>> confidential information. If you are not the intended recipient,
>> you are instructed not to review this transmission. If you are not
>> the intended recipient, please notify the sender that you received
>> this message and delete this transmission from your system.
>