users@jersey.java.net

RE: [Jersey] fastinfoset support

From: Florian Hehlen <Florian.Hehlen_at_imc.nl>
Date: Tue, 19 Jan 2010 08:45:53 +0100

Hi,

Your tip was good. It also allowed me to discover how to log all the request/response traffic on the server... great

I am now having a problem in the client which is claiming that I need to implement a message body reader.

Exception in thread "main" com.sun.jersey.api.client.ClientHandlerException: A message body reader for Java type, class [Lcom.imc.ids.dto.IdsSymbol;, and MIME media type, application/fastinfoset, was not found
                at com.sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:526)
                at com.sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:491)
                at com.sun.jersey.api.client.WebResource.handle(WebResource.java:561)
                at com.sun.jersey.api.client.WebResource.access$300(WebResource.java:69)
                at com.sun.jersey.api.client.WebResource$Builder.get(WebResource.java:451)
                at com.imc.ids.client.resources.SymbolResourceProxy.findAll(SymbolResourceProxy.java:98)
                at com.imc.ids.client.service.SymbolService.findAll(SymbolService.java:82)
                at com.imc.ids.example.browser.tests.SymbolTest.loadAll(SymbolTest.java:36)
                at com.imc.ids.example.browser.tests.SymbolTest.test(SymbolTest.java:29)
                at com.imc.ids.example.browser.Browser.main(Browser.java:38)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                at java.lang.reflect.Method.invoke(Method.java:597)
                at com.intellij.rt.execution.application.AppMain.main(AppMain.java:110)

I have included the fast infoset and jersey-fastinfoset libraries in my client. Is that not enough?

Cheers,
Florian

From: Paul.Sandoz_at_Sun.COM [mailto:Paul.Sandoz_at_Sun.COM]
Sent: 18 January, 2010 12:42
To: users_at_jersey.dev.java.net
Subject: Re: [Jersey] fastinfoset support


On Jan 18, 2010, at 11:23 AM, Florian Hehlen wrote:


The work-around is ok although not elegant... it forces me to write a lot of extra code.

I absolutely agree.

IIRC the current state of affairs was this may be a bug in FI code.

One possible solution to reduce modification to application code may be to write a ResourceFilterFactory [1] that adapts the response entity.

The filter would call:

https://jersey.dev.java.net/nonav/apidocs/latest/jersey/com/sun/jersey/spi/container/ContainerResponse.html#getEntity%28%29

then wrap that and set it with:

https://jersey.dev.java.net/nonav/apidocs/latest/jersey/com/sun/jersey/spi/container/ContainerResponse.html#setEntity%28java.lang.Object%29

Although, in this case one might have to be careful with JAXB contexts.

Paul.

[1] https://jersey.dev.java.net/nonav/apidocs/latest/jersey/com/sun/jersey/api/container/filter/package-summary.html


I have an existing API with methods that return collections which I can not change. So I will have to add special resource methods in the resource classes and a lot of per method annotations.

Cheers,
Florian



From: Paul.Sandoz_at_Sun.COM<mailto:Paul.Sandoz_at_Sun.COM> [mailto:Paul.Sandoz_at_Sun.COM]
Sent: 18 January, 2010 12:06
To: users_at_jersey.dev.java.net<mailto:users_at_jersey.dev.java.net>
Subject: Re: [Jersey] fastinfoset support

Hi Florian,

On Jan 14, 2010, at 3:21 PM, Florian Hehlen wrote:



Hi,

There is an open issue https://jersey.dev.java.net/issues/show_bug.cgi?id=320 about a fastinfoset incompatibility with collections. Is there any known ETA for when this will be fixed?

No, we can try and fix it for 1.1.6 the release after next (6 to 8 weeks after we release 1.1.5, although it may be earlier depending on the OSGi stability). Is that OK for you?




Are there any workarounds at the moment?


The work around is to create a JAXB wrapper bean.

Paul.



________________________________
The information in this e-mail is intended only for the person or entity to which it is addressed.

It may contain confidential and /or privileged material. If someone other than the intended recipient should receive this e-mail, he / she shall not be entitled to read, disseminate, disclose or duplicate it.

If you receive this e-mail unintentionally, please inform us immediately by "reply" and then delete it from your system. Although this information has been compiled with great care, neither IMC Financial Markets & Asset Management nor any of its related entities shall accept any responsibility for any errors, omissions or other inaccuracies in this information or for the consequences thereof, nor shall it be bound in any way by the contents of this e-mail or its attachments. In the event of incomplete or incorrect transmission, please return the e-mail to the sender and permanently delete this message and any attachments.

Messages and attachments are scanned for all known viruses. Always scan attachments before opening them.


________________________________
The information in this e-mail is intended only for the person or entity to which it is addressed.

It may contain confidential and /or privileged material. If someone other than the intended recipient should receive this e-mail, he / she shall not be entitled to read, disseminate, disclose or duplicate it.

If you receive this e-mail unintentionally, please inform us immediately by "reply" and then delete it from your system. Although this information has been compiled with great care, neither IMC Financial Markets & Asset Management nor any of its related entities shall accept any responsibility for any errors, omissions or other inaccuracies in this information or for the consequences thereof, nor shall it be bound in any way by the contents of this e-mail or its attachments. In the event of incomplete or incorrect transmission, please return the e-mail to the sender and permanently delete this message and any attachments.

Messages and attachments are scanned for all known viruses. Always scan attachments before opening them.