resteasy

RestEasy - Parameters Binding - Validation and Errors - EJB

你说的曾经没有我的故事 提交于 2019-12-10 20:13:20
问题 Lets say I define a POJO with parameters that is passed to a REST call class MyVO { @NotNull @PathParam("name") private String name; @NotNull @PathParam("age") private Integer age; // getters and setters } public class RESTclass { public postData( @Form MyVO vo ) { } } It automatically binds the objects in MyVO. But where do I get the validation errors? Does it trigger the validation during binding? If not, how to trigger the validations? Spring does all these well. It has BindingResult

RESTEasy on JBoss 5 - jars needed

♀尐吖头ヾ 提交于 2019-12-10 18:55:41
问题 We are running JBoss 5.1.0 and I'm trying to get just a simple test app up and running with RESTEasy. However, I cannot figure out what I need in order to do this. Apparently new versions of JBoss have everything included, but that doesn't help me. From what I understand, I need to modify the web.xml of my app to include the bootstrap and some other things. And then I need to include some jars in the WEB-INF/lib. This is where I'm stuck. Do I need to include any jars in the server/lib in

Could not find MessageBodyWriter for response object of type: com.sun.jersey.api.json.JSONWithPadding of media type: application/x-javascript

不想你离开。 提交于 2019-12-10 18:44:29
问题 I'm trying to use jsonp on my backbone application. In my webservice, I'm trying to use the Jersey library to use the JSONWithPadding response. Problem is, looks like the "application/x-javascript" is not supported. My code is : @GET @Path("/issues/jsonp") @Produces("application/x-javascript") public JSONWithPadding getIssuesJsonp(@Context HttpServletRequest req, @PathParam("ppid") String qppid, @QueryParam("callback") String callback) { Principal principal = req.getUserPrincipal(); String

Java JAX-RS custom parameter with default value

自古美人都是妖i 提交于 2019-12-10 17:41:03
问题 Let's say I have this (this is just a sample): @GET @Path(value="address") @Produces("application/json") public Response getAddress(@QueryParam("user") User user){ ... } and User is class User{ ... public static User valueOf(String user){ if(user == null) return DEFAULT_USER; return dao.findById(user); } } If I do /api/address?user=amir everything works but the idea is if I don't provide a value for user then I want DEFAULT_USER to be used. But this doesn't actually call valueOf. Is there a

Display html page in tomcat from maven RESTEasy webapp

蹲街弑〆低调 提交于 2019-12-10 17:37:38
问题 I have a problem with my web app created with maven. I use RESTEasy to create some webservices in this app and I want to create a simple html page with a form in this webapp in order to test the @post @FormParam annotations. I created the login.html page located in the 'webapp' folder of my webapplication. but when I tried to reach the page at /resteasyWebapp/login.html or the default jsp page at /resteasyWebapp/index.jsp, it doesn't work. I get a 404 error code. I took a look at the package

character encoding responses with RESTEasy / jax-rs

北慕城南 提交于 2019-12-10 17:25:00
问题 I'm set up using RESTeasy for jax-rs on my server. My client sends a string containing the character '✓', and the server can store that character (I can confirm that it is being stored correctly on the server). However, the server can't seem to return the '✓' in a response - instead, a '?' gets sent. I'm assuming I need to specify a return encoding or something, but I don't know where to do this, or how to check to see what the current encoding is! How do I specify the encoding on my server

How to get RESTEasy to use system web proxy?

本秂侑毒 提交于 2019-12-10 15:56:40
问题 I'm using JAX-RS for a RESTful client in Java 8 with RESTEasy 3.0.10.Final as the implementation on windows 7 64-bit. RESTEasy in turn uses Apache httpclient 4.2.6. I separately learned how to manually specify a web proxy for httpclient, so if in my code I manually configure a ResteasyClientBuilder using a specially configured ApacheHttpClient4Engine , my RESTEasy client connections correctly use the proxy. My problem is that I want to use the java.net.useSystemProxies system property so that

el-api-1.0.jar - jar not loaded - Offending class: javax/el/Expression.class

醉酒当歌 提交于 2019-12-10 15:49:43
问题 I'm trying to get a simple restful service running using RestEasy. Following is my setup. Tomcat7 Eclipse & Maven I Maven Install and copy the war file to webapps folder. When deploying the war file the catalina.out file shows this and the application is not deployed. Mar 24, 2013 9:44:38 PM org.apache.catalina.loader.WebappClassLoader validateJarFile INFO: validateJarFile(/usr/share/tomcat7/webapps/buzzcore-1.0/WEB-INF/lib/el-api-1.0.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2

Resteasy 3.5.0.Final on App Engine standard env - NoSuchFieldError SERVER_SENT_EVENTS_TYPE

一曲冷凌霜 提交于 2019-12-10 14:21:12
问题 I have a pretty basic Java8 application using Resteasy 3.1.4.Final deployed in App Engine standard env. But when I upgrade Resteasy to 3.5.0.Final ; All good in my local env I get the following Stacktrace when deployed: Uncaught exception from servlet java.lang.NoSuchFieldError: SERVER_SENT_EVENTS_TYPE at org.jboss.resteasy.core.ResourceMethodInvoker.isSseResourceMethod(ResourceMethodInvoker.java:162) at org.jboss.resteasy.core.ResourceMethodInvoker.(ResourceMethodInvoker.java:147) at org

RESTEasy and ContextResolver<ObjectMapper> for Jackson

谁都会走 提交于 2019-12-10 14:18:52
问题 I have a problem with the customization of my RESTEasy JSON response. In web.xml I use autoscan: <context-param> <param-name>resteasy.scan</param-name> <param-value>true</param-value> </context-param> Here is my customization class for ObjectMapper , (I've set not null fields and new human readable date): @Provider @Produces(MediaType.APPLICATION_JSON) public class JacksonConfig implements ContextResolver<ObjectMapper> { private Logger log = Logger.getLogger(PropertiesConfig.LOG_CATEGORY);