问题标签 [resteasy]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
363 浏览

java - 将 RestEasy 与 Windows Live 服务一起使用,您如何解组返回的联系人列表?

我正在尝试使用 RestEasy 从 Windows Live 获取我的联系人

成功验证我的用户后,我已调用https://livecontacts.services.live.com/users/@L@ /rest/livecontacts 设置身份验证标头,添加我的 id 和我的令牌

如果我使用 cUrl 从命令行进行调用,我会得到预期的输出,但在我的 Web 应用程序中,我得到的是乱码

例如

...?{?[??e^7E?...

当前接口类是

扔掉测试:

有谁知道如何解组响应

0 投票
5 回答
8334 浏览

java - 从 Jersey 迁移到 RESTEasy 时为 Null 内容类型。

所以我写了一个示例 REST 资源,它在 Jersey/Tomcat 中就像一个魅力,但是当我把它带到 RestEASY/Tomcat 时它会爆炸。我是说真的吗?开箱即用发生了什么。总之有点沮丧。尝试访问资源时出现此错误(http://localhost:7070/mg/mytest

“内容类型为空并期望提取正文”

7842 [http-7070-2] 错误 com.loyalty.mg.rest.exception.MGExceptionMapper - 异常映射器中捕获的错误 - org.jboss.resteasy.spi.BadRequestException:内容类型为空并期望在org.jboss.resteasy.core.MessageBodyParameterInjector.inject(MessageBodyParameterInjector.java:131) at org.jboss.resteasy.core.MethodInjectorImpl.injectArguments(MethodInjectorImpl.java:98) at org.jboss.resteasy.core.MethodInjectorImpl.invoke( MethodInjectorImpl.java:121) at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:247) at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:212) at org.jboss.resteasy .core.ResourceMethod.invoke(ResourceMethod.java:202)

我想问题也是 - RestEASY 是否比泽西更好,这只是开始,我遇到了错误。我应该坚持泽西岛吗?

也已经尝试过了:)

0 投票
2 回答
6336 浏览

jax-rs - 如何在 RestEasy Client 中获取 ClientResponseFailure 的详细信息?

返回状态 >=400 时如何获取 http 响应内容。那是我的代码示例:

这抛出:

我想了解更多详细信息,而不仅仅是状态码 400。

0 投票
1 回答
2333 浏览

java - RESTEasy-Spring 集成 webapp 抛出神秘错误:NoResourceFoundFailure

我正在开发一个同时使用 Spring Framework 和 RESTEasy 的 web 应用程序。该应用程序已配置为发送 REST 请求有一段时间了,但我最近将其设置为也接收 REST 请求。我适当地配置了我的 web.xml,并且应用程序已经毫无问题地接收并处理了 REST 请求

这是一个 web.xml 片段,详细说明了 REST 设置:

但是,当我在浏览器中浏览应用程序时,我不断在日志中看到这些异常:

在我看来,REST 突然尝试处理所有请求,而不仅仅是匹配 /AutomatedProcessing/rest/* URL 模式的请求。 我没有找到有关NoResourceFoundFailure异常的详细信息,或者 REST 为何会尝试处理其分配的 URL 模式之外的请求。该异常对用户来说不是致命的,但我认为它可能会破坏我不知道的东西。另外,日志中的异常永远不会有趣。我将不胜感激有关此异常的任何见解!

0 投票
2 回答
2826 浏览

java - RESTEasy 中的 ExceptionMapper 问题

在我的 JAXRS 应用程序中,我有 2 个ExceptionMapper注册为@Provider

当我的应用程序抛出一个新MyCustomRuntimeException的,异常被捕获在里面MyExceptionMapper,即使(JAX-RS 规范说)它应该被捕获在 MyCustomRuntimeExceptionMapper 中。

这是 JAXRS 所说的 -

JAX-RS 也支持异常继承。当抛出异常时,JAX-RS 将首先尝试找到该异常类型的 ExceptionMapper。如果找不到,它将寻找一个可以处理异常超类的映射器。它将继续这个过程,直到没有更多的超类可以匹配。

有没有人有线索,这里发生了什么?

0 投票
1 回答
4342 浏览

jax-rs - 从 JAX-RS 中的另一个 ExceptionMapper 调用 ExceptionMapper

在我的 RESTEasy 应用程序中,我得到一个java.lang.reflect.UndeclaredThrowableException, 因为一个检查的异常是从一个没有在 throws 子句中声明异常的方法抛出的。
所以我正在写一个UndeclaredThrowableExceptionMapper. 包装真正的UndeclaredThrowableException异常;我打电话e.getCause()去找回它。
然后我可以扔掉它或以某种方式查找正确ExceptionMapper的处理方法吗?

0 投票
0 回答
2901 浏览

java - RestEasy csv file upload (multipart / form-data) garbles iso-8859-1 characters in FireFox

I have a multipart / form-data form to upload a csv file to a rest easy (JAX RS) webservice. This file can contain iso-8859-1 characters like for example é. When I upload the file through Firefox these characters are garbled and they end up like a ?. When I upload the file through Internet Explorer everything works fine.

I've done a lot of reading and found out that there's a problem in firefox combining multipart / form-data and the charset attribute (enctype='multipart/form-data; charset=ISO-8859-1') doesn't work.

So I've tried setting <meta http-equiv="Content-Type" content="text/csv; charset=iso-8859-1" /> in my HTML page (I also tried setting text/html or multipart/form-data in stead of text/csv but none of that seems to make a difference.

I went through the rest easy api and found something about 'overwriting the default fallback content type for multipart messages'. The default fallback when no content type is found is us-ascii. The characters I try to process (é,..) don't exist in us-ascii so it makes sense they end up garbled. Overriding this default fallback content type doesn't seem to help either (see: http://docs.jboss.org/resteasy/docs/1.2.GA/userguide/html/Multipart.html)

So am I right when I say that Internet Explorer sends the content-type+charset correctly in the http header, so everything goes well. And that firefox messes things up while trying to send the content-type/charset while combined with multipart/form-data? I have done my searching through stackoverflow but none of the approved solutions seem to work in my case.

Has anybody had this specific problem before? (multipart / form-data file upload using Jboss rest easy framework)? Something else I can try?

Thanks in advance!

Yannick

0 投票
4 回答
52391 浏览

apache - 如何在 Jersey、Apache Wink 和 JBoss RESTEasy 之间进行选择?

我刚听说Apache Wink,我想知道它与JerseyJBoss RESTEasy相比有什么不同。有什么可以做其他两个做不到的?

我们一直将 Jersey 用于我们的一些内部项目,主要是因为它很简单,但我真的不知道是什么让另外两个更好,我会考虑切换。有没有人有任何用例来满足每个细分市场的需求?

0 投票
1 回答
4175 浏览

web-services - RESTEasy 相对于 Apache CXF 的优势?

我使用 Apache CXF 实现了 Restful Web 服务。由于我打算使用 JBoss 进行部署,我正在考虑迁移到 RESTEasy,因为它提供了更好的 JBoss 集成。

除了更好的服务器集成之外,RESTEasy 与 Apache cxf 相比还有哪些优势?

0 投票
1 回答
1337 浏览

resteasy - POST 上的 RestEasy ClientRequest followRedirect 行为

据我所知,从宁静的意义上说,处理新资源的创建的正确方法是发布请求,然后通过标头位置字段将客户端重定向到结果。

似乎 ClientRequest 不支持这一点。我无法让 ClientRequest 在发布后自动遵循查看其他 (303) 重定向。当 RestEasy 客户端框架创建 PostMethod 时,followRedirect 设置为 false,忽略 ClientRequest 上设置的 followRedirect。

还有其他方法吗?