没有讯息的作曲家
我正在尝试使用Resteasy-RxJava2在VERTX应用程序中使用JAXB提供XML文档(使用我们拥有的非Evertx Legacy库)。但是我得到:
Could not find MessageBodyWriter for response object of type:
org.jboss.resteasy.rxjava2.propagation.ContextPropagatorOnSingleAssemblyAction$ContextPropagatorSingle of media type:
application/xml;charset=UTF-8
据我所知,这取决于MessageBodyWriter
和resteasy-rxjava2依赖项中的
(resyncresponseprovider
singleprovider
)。
我有以下Resteasy Service定义,
@GET
@Path(FdsnwsPaths.QUERY)
@Produces(MediaType.APPLICATION_XML)
@Stream
// CHECKSTYLE:OFF too many parameters
public Response getQuery(...)
如何使用Single -Provider
或其他方式将其重新恢复到正确地提供数据。
I'm trying to use resteasy-rxjava2 to provide an XML document using jaxb, within a vertx application (using a non-vertx legacy library we have). But I get:
Could not find MessageBodyWriter for response object of type:
org.jboss.resteasy.rxjava2.propagation.ContextPropagatorOnSingleAssemblyAction$ContextPropagatorSingle of media type:
application/xml;charset=UTF-8
From what I can tell, this comes down to the difference between a MessageBodyWriter
and the AsyncResponseProvider
that is in the resteasy-rxjava2 dependency for a Single
(SingleProvider
).
I have the following resteasy service definition
@GET
@Path(FdsnwsPaths.QUERY)
@Produces(MediaType.APPLICATION_XML)
@Stream
// CHECKSTYLE:OFF too many parameters
public Response getQuery(...)
How do I get resteasy to properly serve the data asynchrously, using the SingleProvider
or otherwise.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
@get
方法必须明确返回单身
它不起作用。 (无法使用响应
或对象
)。就我而言,单
包含JAXB XML root元素。然后,为了使事情变得更复杂,为了处理特定的异常类型并将其映射到特定的响应状态代码,我必须创建一个Custom
exceptionMapper
,该创建响应>响应
object我曾经能够直接在方法中创建。 (在Resteasy-vertx中,我没有找到有关如何执行此操作的文档,但是就我而言,我正在创建自己的vertxresteasyDeployment
对象,因此我可以注册ExceptionMapper的类:作为参考,这一切都完成了:
The
@Get
method must return theSingle
explicitly or it doesn't work. (Can't useResponse
orObject
). In my case, theSingle
contains the jaxb xml root element.Then, to make things more complicated, in order to handle specific exception types and map them to specific response status codes, I have to create a custom
ExceptionMapper
which creates theResponse
object I used to be able to create directly in the method. (in resteasy-vertx, I found no documentation on how to do this, but in my case, I am creating my ownVertxRestEasyDeployment
object so I can register the class of the ExceptionMapper(s) like this:For reference, this is all being done with: