无法找到MessageBodyReader [英] unable to find a MessageBodyReader

查看:63
本文介绍了无法找到MessageBodyReader的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个界面:

 @Path("inbox")
public interface InboxQueryResourceTest {

    @POST
    @Path("{membershipExternalId}/query")
    @Consumes(MediaType.APPLICATION_XML)
    @Produces("multipart/mixed")
    public MultipartOutput query(@PathParam("membershipExternalId") final String membershipExternalId,
                             @QueryParam("page") @DefaultValue("0") final int page,
                             @QueryParam("pageSize") @DefaultValue("10") final int pageSize,
                             @QueryParam("sortProperty") final List<String> sortPropertyList,
                             @QueryParam("sortReversed") final List<Boolean> sortReversed,
                             @QueryParam("sortType") final List<String> sortTypeString,
                             final InstanceQuery instanceQuery) throws IOException;
}

我已经实现了返回MultipartOutput的方法。
我发布了一个来自Fiddler的xml查询,我收到的结果没有任何问题。

I have implemented the method to return a MultipartOutput. I am posting an xml query from Fiddler and i receive the result without any problem.

但是我已经对同一个界面进行了集成测试,我发送相同的对象,我把响应像:

BUT i have done an integration test for the same interface, i send the same objects and i put the response like:

final MultipartOutput multiPartOutput = getClient().query(getUserRestAuth(), 0, 25, null, null, null, instanceQuery);

但是在这里,所以从集成测试中,我收到一个奇怪的错误:

But here, so from integration tests, i receive a strange error:


无法找到内容类型为multipart / mixed的BorderBodyReader; boundary =74c5b6b4-e820-452d-abea-4c56ffb514bb并输入class org.jboss.resteasy。 plugins.providers.multipart.MultipartOutput

Unable to find a MessageBodyReader of content-type multipart/mixed;boundary="74c5b6b4-e820-452d-abea-4c56ffb514bb" and type class org.jboss.resteasy.plugins.providers.multipart.MultipartOutput

任何人都有任何想法为什么只有在集成测试中才会收到此错误?

Anyone has any ideea why only in integration tests i receive this error?

PS:有些人会说我不发送application / xml作为ContentType而是发送多部分,这当然是假的,因为对象是用所需的@XmlRootElement等注释的,否则都不是POST来自Fiddler会工作。

PS: Some of you will say that i do not send application/xml as ContentType but multipart, which of course is false because the objects are annotated with the required @XmlRootElement etc, otherways neither the POST from Fiddler would work.

推荐答案

你可以试试这个:

ResteasyProviderFactory providerFactory = ResteasyProviderFactory.getInstance();
providerFactory.registerProvider(org.jboss.resteasy.plugins.providers.multipart.MimeMultipartProvider.class);

这篇关于无法找到MessageBodyReader的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆