guilhem legal wrote:
> hi!
>
> I'm trying to do a simple thing (I think) with jersey but its not working.
> I want to handle two different POST request with diferent MIME type.
> I use an other application whitch is supposed to send the request :
>
Are you getting an exception on the server side when the client POSTs
the request with the content type of "text/xml" ?
I just wrote a little example and verified that i get an exception in
this case, with the error:
Caused by: java.lang.IllegalArgumentException: A message body reader
for Java type, class java.lang.Object, and MIME media type, text/xml,
was not found
Note i am using Jersey 0.6 (but for this case it is equivalent to that
in 0.5).
I think the problem is you are using the Object type for the request
entity of the doPOSTXml method. The runtime does not know what to do
with Object type. If you use an explicit JAXB type then it should work.
But maybe you want to handle multiple JAXB types for the request entity?
Unfortunately that is not currently possible. I am not sure it is
possible given the current way message body readers work, i would need
to look more closely at this.
Paul.
> my code :
>
> @HttpMethod("GET")
> public Response doGET() throws JAXBException {
>
> return treatIncommingRequest();
> }
> @HttpMethod("POST")
> @ConsumeMime("application/x-www-form-urlencoded")
> public Response doPOSTKvp(String request) throws JAXBException {
> -------------------------------------------------------
> }
>
> @HttpMethod("POST")
> @ConsumeMime("text/xml")
> public Response doPOSTXml(Object request) throws JAXBException {
> ----------------------------------------------------------------
> }
>
> It never enter in the method doPOSTXml. So have i make a mistake?
>
> Guilhem Legal
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
--
| ? + ? = To question
----------------\
Paul Sandoz
x38109
+33-4-76188109