Hi,
For those of you with cases where a client may send an entity or no
entity (such as is the case for WebDAV clients) i have finally come up
with and implemented an appropriate solution:
The com.sun.jersey.core.provider.EntityHolder type may be utilized
as a
"meta-entity" to determine whether a request consumed by the
server, or a
response consumed by the client, contains the entity or contains no
entity,
for example:
@POST
@Consumes("text/plain")
public void post(EntityHolder<MyJAXBObject> s) {
if (s.hasEntity()) {
MyJAXBObject entity = s.getEntity();
} else {
...
}
}
This works independently of the strategy associated with the type of
the entity, for example if the parameter of the above post method was
just "MyJAXBObject t" and the client sent no entity it would result in
a 400 response as the server is expecting an XML document.
Paul.