0

I'm trying to migrate a Jersey 1.0 Client application to Jersey 2.0. So far everything work except with the content-type : /application/fastinfoset

I used Jeysey 2.21.1 BOM so jersey fastinfoset is included in the dependencies.

My problem is that I didn't find how to register FastInfoSet.

I obtain MessageReaderBody exception.

Sebastien Dionne
  • 757
  • 2
  • 19
  • 34
  • Haven't tried it, but looking at [this test](https://github.com/jersey/jersey/blob/b7907e279010e7035a7a3e529993d22f77a21e08/tests/e2e/src/test/java/org/glassfish/jersey/tests/e2e/entity/EntityTypesTest.java#L779), and [this issue](https://java.net/jira/browse/JERSEY-1190), I'd say it's not supported – Paul Samsotha Feb 07 '16 at 01:50
  • Oh boy, that's bad. There is something that can do that and simply replace my mode for the new method ? And thanks for your answer – Sebastien Dionne Feb 07 '16 at 19:07
  • I'll try to look at Apache CXF and see if I can't take some code from there. – Sebastien Dionne Feb 08 '16 at 00:56
  • Here is the [Jersey 1.x support](https://github.com/jersey/jersey-1.x/tree/master/jersey-fastinfoset/src/main/java/com/sun/jersey/fastinfoset/impl/provider/entity). I'm not quite sure why they didn't just port it to 2.x, but I would try just using that implementation. – Paul Samsotha Feb 08 '16 at 02:06
  • I created a demo for a issue that I created on JIRA for Jersey. The code is working for application/fastinfoset https://java.net/jira/browse/JERSEY-3053 – Sebastien Dionne Feb 11 '16 at 13:33

2 Answers2

1

You need to register Jersey 2 compliant FI providers. Something like

private Client client() {
    ClientConfig config = new ClientConfig();
    config.register(FastInfosetJAXBElementProvider.class);
    config.register(FastInfosetRootElementProvider.class);
    config.property(ClientProperties.CONNECT_TIMEOUT, 5000);
    config.property(ClientProperties.READ_TIMEOUT, 15000);
    return JerseyClientBuilder.createClient(config);
}

Provider classes are from this repo:

https://github.com/jecklgamis/jersey-fastinfoset-provider

Hope this helps.

jecklgamis
  • 11
  • 1
0

I created a demo for a issue that I created on JIRA for Jersey. The code is working for application/fastinfoset https://java.net/jira/browse/JERSEY-3053

I works for Entity and InputStream. I didn't cover the MessageBodyCover yet.

Sebastien Dionne
  • 757
  • 2
  • 19
  • 34