users@jersey.java.net

Re: [Jersey] Force contenttype?

From: tarjei <tarjei_at_nu.no>
Date: Fri, 06 Feb 2009 11:03:55 +0100

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi, replying to myself here as I found one mistaken assumption just
after posting:
> r2.post(MyDocument.class, document);
The first parameter here refers to what you get back- not what you are
posting. Thus, the correct way to get a string back is:
r2.post(String.class, document);

This solves one of the questions. I'm sorry for being a bit quick on the
send button.

Regards,
Tarjei

>
> And get:
> com.sun.jersey.api.client.ClientHandlerException: A message body reader
> for Java type, class com.scanmine.indexPlugin.IndexerDocument, and MIME
> media type, text/html;charset=UTF-8, was not found
>
> Now, I changed my PHP server and added
> header ('Content-type: application/xml');
>
> Which resolved that issue, but the server responds with just an "OK" and
> that gives me:
>
> javax.ws.rs.WebApplicationException: javax.xml.bind.UnmarshalException
> - with linked exception:
> [org.xml.sax.SAXParseException: Content is not allowed in prolog.]
>
> In the end, my questions are:
> * How can I force the Client to send marshaled XML regardless of the
> servers content-type?
>
> * How can I make the client accept a simple string, while posting the
> marshalled document to the server?
>
>
>
> Regards,
> Tarjei

- ---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
For additional commands, e-mail: users-help_at_jersey.dev.java.net


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJjAsLYVRKCnSvzfIRAiK0AKCE160I4Z7ISj3LLJ2fjGs4G/FvBACeJTwb
oebsePdDYd1XPlDC+behYbg=
=R3uC
-----END PGP SIGNATURE-----