Sebastien Dionne
Sebastien Dionne

Reputation: 776

migrate to Jersey 2.x with fastinfoset

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.

Upvotes: 0

Views: 177

Answers (2)

jecklgamis
jecklgamis

Reputation: 11

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.

Upvotes: 1

Sebastien Dionne
Sebastien Dionne

Reputation: 776

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.

Upvotes: 0

Related Questions