You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by gregor stopar <gs...@gmail.com> on 2014/01/13 17:26:05 UTC

RESTEasy XML byte order marker


Hi

I have RESTEasy client which is constructed like this:

ResteasyClient client = new 
ResteasyClientBuilder().httpEngine(httpEngine).build();
ResteasyWebTarget snowConditionTarget = client.target(host);
SnowConditionClient snowConditionClient = 
snowConditionTarget.proxy(SnowConditionClient.class);

(SnowConditionClient is interface)

When I try to read entity: response.readEntity(SnowConditionResponse.class);
I get Unmarshall exception: "Content is not allowed in prolog".

This is because XML has byte order marker (BOM).

Question:
How can I skip BOM ?


I implemented custom MessageBodyReader but Tapestry refuses to use it 
(or I'm doing something wrong).
I put this class in services package and even try with manual 
registration, with no success:

ResteasyProviderFactory instance = ResteasyProviderFactory.getInstance();
RegisterBuiltin.register(instance);
instance.registerProvider(SnowConditionProvider.class);



Thanks,
Regards

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: RESTEasy XML byte order marker

Posted by Alejandro Scandroli <al...@gmail.com>.
Hi Gregor

Are you using resteasy on the server side too? in that case: are you
using the tapestry-resteasy module or are you integrating resteasy
yourself?
Can you show the code for the service that’s giving you the error?

What’s the servers response in plain text? can you capture it?
The "Content is not allowed in prolog” error is usually due to a non
json or xml response.
For instance: a method that returns just a simple string


Alejandro.









On Mon, Jan 13, 2014 at 5:26 PM, gregor stopar <gs...@gmail.com> wrote:
>
>
> Hi
>
> I have RESTEasy client which is constructed like this:
>
> ResteasyClient client = new
> ResteasyClientBuilder().httpEngine(httpEngine).build();
> ResteasyWebTarget snowConditionTarget = client.target(host);
> SnowConditionClient snowConditionClient =
> snowConditionTarget.proxy(SnowConditionClient.class);
>
> (SnowConditionClient is interface)
>
> When I try to read entity: response.readEntity(SnowConditionResponse.class);
> I get Unmarshall exception: "Content is not allowed in prolog".
>
> This is because XML has byte order marker (BOM).
>
> Question:
> How can I skip BOM ?
>
>
> I implemented custom MessageBodyReader but Tapestry refuses to use it (or
> I'm doing something wrong).
> I put this class in services package and even try with manual registration,
> with no success:
>
> ResteasyProviderFactory instance = ResteasyProviderFactory.getInstance();
> RegisterBuiltin.register(instance);
> instance.registerProvider(SnowConditionProvider.class);
>
>
>
> Thanks,
> Regards
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org