我试图将Jersey 1.0客户端应用程序迁移到Jersey 2.0。到目前为止,一切都有效,除了内容类型:/ application / fastinfoset
我使用了Jeysey 2.21.1 BOM,因此jersey fastinfoset包含在依赖项中。
我的问题是我没有找到如何注册FastInfoSet。
我获取了MessageReaderBody异常。
答案 0 :(得分:1)
您需要注册符合Jersey 2标准的FI提供商。像
这样的东西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);
}
提供者类来自此repo:
https://github.com/jecklgamis/jersey-fastinfoset-provider
希望这有帮助。
答案 1 :(得分:0)
我创建了一个针对我在JIRA上为Jersey创建的问题的演示。该代码适用于application / fastinfoset https://java.net/jira/browse/JERSEY-3053
我为Entity和InputStream工作。我还没有报道MessageBodyCover。