没有讯息的作曲家

发布于 2025-02-07 14:48:34 字数 749 浏览 1 评论 0原文

我正在尝试使用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

据我所知,这取决于MessageBodyWriterresteasy-rxjava2依赖项中的resyncresponseprovidersingleprovider)。

我有以下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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

信愁 2025-02-14 14:48:34

@get方法必须明确返回单身它不起作用。 (无法使用响应对象)。就我而言,包含JAXB XML root元素。

  @GET
  @Path(FdsnwsPaths.QUERY)
  @Produces(MediaType.APPLICATION_XML)
  @Stream
  public Single<FDSNStationXML> getQuery(...)

然后,为了使事情变得更复杂,为了处理特定的异常类型并将其映射到特定的响应状态代码,我必须创建一个Custom exceptionMapper,该创建响应>响应 object我曾经能够直接在方法中创建。 (在Resteasy-vertx中,我没有找到有关如何执行此操作的文档,但是就我而言,我正在创建自己的vertxresteasyDeployment对象,因此我可以注册ExceptionMapper的类:

VertxResteasyDeployment deployment = new VertxResteasyDeployment();
deployment.getActualProviderClasses().addAll(providerClasses);

作为参考,这一切都完成了:

  • Resteasy 5.0.3.final(包括Resteasy-rxjava2)
  • rxjava 2.2.2.20
  • vertx 3.9.5

The @Get method must return the Single explicitly or it doesn't work. (Can't use Response or Object). In my case, the Single contains the jaxb xml root element.

  @GET
  @Path(FdsnwsPaths.QUERY)
  @Produces(MediaType.APPLICATION_XML)
  @Stream
  public Single<FDSNStationXML> getQuery(...)

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 the Response 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 own VertxRestEasyDeployment object so I can register the class of the ExceptionMapper(s) like this:

VertxResteasyDeployment deployment = new VertxResteasyDeployment();
deployment.getActualProviderClasses().addAll(providerClasses);

For reference, this is all being done with:

  • RestEasy 5.0.3.Final (including resteasy-rxjava2)
  • RxJava 2.2.20
  • Vertx 3.9.5
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文