users@jersey.java.net

[Jersey] Doesn't find reader, but list it?

From: Markus Karg <karg_at_quipsy.de>
Date: Fri, 18 Feb 2011 10:51:58 +0100

I am a bit confused about an error message in Jersey 1.4.

 

I am PUTting a XML into a method that is marked as @Consumes(<some
custom mime type>). The content variable is marked as XMLRootElement. As
I forgot to provide the Content-Type header with the PUT, it is clear
that Jersey complains about my fault, but what confuses me is the error
message's explanation. Below you can see the (correct) complaint, but
look down to the list of registered providers for ANY (*/*) content
type. It does contain XMLRootElementProvider. So I understand that even
with no mime provided, Jersey would be able to find that provider, but
it actually does not use it...?

 

Can someone shed some light on that? I understand what my fault is, I
just don't understand why Jersey lists XMLRootElementProvider for */*
but doesn't actually use it in this case.

 

SCHWERWIEGEND: A message body reader for Java class
de.quipsy.entities.ControlPlan, and Java type class
de.quipsy.entities.ControlPlan, and MIME media type
application/octet-stream was not found

18.02.2011 10:39:00 com.sun.jersey.spi.container.ContainerRequest
getEntity

SCHWERWIEGEND: The registered message body readers compatible with the
MIME media type are:

application/octet-stream ->

  com.sun.jersey.core.impl.provider.entity.ByteArrayProvider

  com.sun.jersey.core.impl.provider.entity.FileProvider

  com.sun.jersey.core.impl.provider.entity.InputStreamProvider

  com.sun.jersey.core.impl.provider.entity.DataSourceProvider

  com.sun.jersey.core.impl.provider.entity.RenderedImageProvider

*/* ->

  com.sun.jersey.core.impl.provider.entity.FormProvider

  com.sun.jersey.core.impl.provider.entity.MimeMultipartProvider

  com.sun.jersey.core.impl.provider.entity.StringProvider

  com.sun.jersey.core.impl.provider.entity.ByteArrayProvider

  com.sun.jersey.core.impl.provider.entity.FileProvider

  com.sun.jersey.core.impl.provider.entity.InputStreamProvider

  com.sun.jersey.core.impl.provider.entity.DataSourceProvider

 
com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$General

  com.sun.jersey.core.impl.provider.entity.ReaderProvider

  com.sun.jersey.core.impl.provider.entity.DocumentProvider

 
com.sun.jersey.core.impl.provider.entity.SourceProvider$StreamSourceRead
er

 
com.sun.jersey.core.impl.provider.entity.SourceProvider$SAXSourceReader

 
com.sun.jersey.core.impl.provider.entity.SourceProvider$DOMSourceReader

 
com.sun.jersey.json.impl.provider.entity.JSONJAXBElementProvider$General

 
com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$General

 
com.sun.jersey.core.impl.provider.entity.XMLListElementProvider$General

  com.sun.jersey.core.impl.provider.entity.XMLRootObjectProvider$General

  com.sun.jersey.core.impl.provider.entity.EntityHolderReader

 
com.sun.jersey.json.impl.provider.entity.JSONRootElementProvider$General

 
com.sun.jersey.json.impl.provider.entity.JSONListElementProvider$General