jsr339-experts@jax-rs-spec.java.net

[jsr339-experts] _at_Consumes matching when Content-Type is null

From: Bill Burke <bburke_at_redhat.com>
Date: Wed, 22 May 2013 15:56:42 -0400

@Consumes("text/plain")
@POST
@Path("plain")
public void tckPOST();

@Path("start")
@POST
public void start()

@Path("start")
@POST
@Consumes("application/xml")
public void start(XML xml)


I have 2 different test cases whose solutions currently conflict.


Case #1:

The TCK is posting a NULL entity with no Content-Type header to:

POST /plain

The TCK is expecting this to match tckPOST() even though two different
sections of the spec conflict:

- Section 4.2.1.1 Says that if the request does not contain a
Content-Type, then application/octet-stream is used. This is for
matching bodies though.

- The matching algorithm in Step 3(a) says:

"The media type of the request entity body *(if any)* is supported by
the input format"

What does *if any* mean? The TCK seems to assume that if the
Content-Type header is null, then the @Consumes annotation is ignored.
Or am I supposed to look at the method to see if it is expecting a
request body?

Which brings me to Case #2:

User has the start() methods above. The request is:

POST /start - no content-type

Is this an ambiguous mapping since any @Consumes would be ignored
because there is no Content-Type header? Or is Content-Type supposed to
default to application/octet-stream? Or, am I supposed to introspect
the method to see if it is expecting a body?




-- 
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com