resteasy

Maven shade + resteasy Could find writer for content-type

帅比萌擦擦* 提交于 2019-12-31 04:01:07
问题 I have a project that works fine with maven managed dependencies. But I have a requirement for giving my jar files as one. For this I use maven-shade plugin (http://maven.apache.org/plugins/maven-shade-plugin/). All class files are exported correctly but when I try to run my application I get an error as: Could find writer for content-type multipart/form-data type: org.jboss.reasteasy.plugins.provider.multipart.MultipartFormDataOutput Any help would be great, thanks. Note: I had a similar

RESTful架构3--开发实战

一曲冷凌霜 提交于 2019-12-31 01:39:10
转自: REST服务开发实战   如果要说什么是REST的话,那最好先从Web(万维网)说起。   什么是Web呢?读者可以查看维基百科的词条( http://zh.wikipedia.org/zh-cn/Web ),具体的我就不多说了。总之,Web是我们在互联网上最常用的服务,甚至在某些人的心中,互联网就是Web。当然,Web只是互联网的一部分而已,只是大家用的最多而已,我们访问的所有网站都是基于Web。   那么,Web和REST之间究竟有什么关系呢?我们接下来将聊聊组成Web的几大基础技术, URI (统一资源标识符,用来标识资源)、 HTTP (超文本传输/转移协议,用来操作资源)、 Hypertext (超文本,用来描述资源的内容与状态,我们可以用HTML、XML、JSON或者自定义格式的文本来描述任何一个资源)。   那我们再来看看什么是REST呢?其实REST并不是一种新兴的技术语言,也不是什么新的技术框架。准确来说说REST只是一种概念、风格或者约束,是回归HTTP本身的建议。   REST是由Roy Thomas Fieding在他的博士论文《Architectural Styles and the Design of Network-based Software Architectures》(《架构风格与基于网络的软件架构设计》)中提出的一种架构思想。Roy

RestEasy - Unable to find MessageBodyReader?

谁说我不能喝 提交于 2019-12-30 09:22:52
问题 I've written a simple RestEasy client proxy to perform an iTunes search. It looks like this: @Path("/") public interface AppleAppStoreLookupClient { /** * Attempts to lookup an apple app store item by its ID * * @param id * The item ID * @return The app details */ @GET @Path("/lookup") @Produces(value = { "text/javascript" }) public AppleAppDetailsResponse lookupByID(@QueryParam("id") String id); } My JSON model class is simple, as well. In fact, for the first call all I want is the

RestEasy - Unable to find MessageBodyReader?

一曲冷凌霜 提交于 2019-12-30 09:22:08
问题 I've written a simple RestEasy client proxy to perform an iTunes search. It looks like this: @Path("/") public interface AppleAppStoreLookupClient { /** * Attempts to lookup an apple app store item by its ID * * @param id * The item ID * @return The app details */ @GET @Path("/lookup") @Produces(value = { "text/javascript" }) public AppleAppDetailsResponse lookupByID(@QueryParam("id") String id); } My JSON model class is simple, as well. In fact, for the first call all I want is the

Multiple endpoints with Resteasy

浪子不回头ぞ 提交于 2019-12-30 08:14:29
问题 I have two separate handfuls of REST services in one application. Let's say a main "people" service and a secondary "management" service. What I want is to expose them in separate paths on the server. I am using JAX-RS, RESTEasy and Spring. Example: @Path("/people") public interface PeopleService { // Stuff } @Path("/management") public interface ManagementService { // Stuff } In web.xml I currently have the following set-up: <listener> <listener-class>org.jboss.resteasy.plugins.server

javax.ws.rs.NotFoundException: Could not find resource for full path

醉酒当歌 提交于 2019-12-30 04:42:08
问题 Environment Windows 7(64) jdk1.7.0_51(64) RESTEasy3.0.7 apache-tomcat-7.0.50 Project Name: hello RESTEasyHelloWorldService.java: package com.javacodegeeks.enterprise.rest.resteasy; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; @Path("/RESTEasyHelloWorld") public class RESTEasyHelloWorldService { @GET @Path("/{param}") @Produces(MediaType.TEXT_PLAIN) public String getMsg(@PathParam("param") String

Two GET methods with different query parameters

ⅰ亾dé卋堺 提交于 2019-12-30 03:09:27
问题 Could we create the same GET URI but with different query parameters? For example, I have two REST GET URIs: /questions/ask/?type=rest /questions/ask/?byUser=john Now the REST service is not recognizing two GET methods as separate and considering it only 1 GET method which is declared as first. Why is it behaving this way? Is there any way that I could make two GET methods having different Query Parameters? It would be highly appreciated if you could quote any resource. 回答1: Because a

How to catch RESTEasy Bean Validation Errors?

微笑、不失礼 提交于 2019-12-29 07:15:14
问题 I am developing a simple RESTFul service using JBoss-7.1 and RESTEasy. I have a REST Service, called CustomerService as follows: @Path(value="/customers") @ValidateRequest class CustomerService { @Path(value="/{id}") @GET @Produces(MediaType.APPLICATION_XML) public Customer getCustomer(@PathParam("id") @Min(value=1) Integer id) { Customer customer = null; try { customer = dao.getCustomer(id); } catch (Exception e) { e.printStackTrace(); } return customer; } } Here when I hit the url http:/

What is the proper replacement of the Resteasy 3.X PreProcessInterceptor?

非 Y 不嫁゛ 提交于 2019-12-29 04:29:05
问题 I'm building rest service using an authentication/authorization mechanism as described in this tutorial: http://howtodoinjava.com/2013/06/26/jax-rs-resteasy-basic-authentication-and-authorization-tutorial/ Basically it uses the PreProcessInterceptor interface to scan the target method for annotations (from javax.annotation.security package) which describe the required roles to access that method. As the the authenticator here is an interceptor, it can cancel the target method invocation,

Request-scoped context field injections into RESTEasy singletons

别等时光非礼了梦想. 提交于 2019-12-28 06:24:09
问题 While trying to embed RESTEasy with singleton resources in OSGi (using something similar to resteasy-osgi-bundle), to my surprise field-injected @Context UriInfo was available and valid on each request. Digging deeper I found proxy magic and ThreadLocal in ResteasyProviderFactory . All well and good, but I cannot find any reference to such a behavior in docs, neither in RESTEasy's one nor in JAX-RS spec. In Jersey docs we can find something like: The exception exists for specific request