jersey

This dependency gives me two versions of one jar. How do I fix this?

跟風遠走 提交于 2019-12-07 02:38:26
问题 I'm using Gradle for my project. One of the dependencies I have specified in my build.gradle is compile 'org.glassfish.jersey.media:jersey-media-moxy:2.0' This works fine on a normal Java application, however when I try to build it on Android I get: When looking at which libraries are referenced, it's clear that there's both javax.inject-2.3.0-b05.jar and javax.inject-1.jar , which I found are added by the dependency above. I'm guessing that this 'duplicate' jar is what causes the build error

REST @FormParam is null

橙三吉。 提交于 2019-12-07 02:36:27
I have the following being passed from browser to server Status Code:204 No Content Request Method:POST Content-Type:application/x-www-form-urlencoded Form Data json:{"clientName":"PACK","status":"success","message":"successful!"} and in jsp code var loginData = { clientName: cList, status: "success", message: "successful!" }; $.ajax({ url: subUrl, type: 'POST', contentType : "application/x-www-form-urlencoded", data: { json: JSON.stringify(loginData) }, success: function (data) { handleLoginResult(data); } }); And in Java code I have @POST public Object persistResetPasswordLogs(@FormParam(

create a Jax-RS RESTful service that accepts both POST and GET?

安稳与你 提交于 2019-12-07 02:26:58
问题 I'm converting one of my existing service to become RESTful and I've got the basic things working with RestEasy. Some of my client apps should be able to execute both GET and POST requests to several services. I'm just seeking if there is any easy way around jax-rs to specify that API should accept both GETs and POSTs. Following you can find a test method, let me know if you see any way around without duplicating this in another class with @GET and @QueryParam. @POST @Path("/add") public

Exception starting application on webspere 8.5

允我心安 提交于 2019-12-07 02:11:55
问题 I'm getting this error starting web application on WebSphere 8.5. Application calls thru MyBatis stored procedures on DB2. User triggers calls using REST WS, implemented using Jersey framework. Spring glues everything together. The same application works fine on Tomcat 7. Did anyone see this error? Any help will be appreciated). It looks like it fails to initialize Context and Dependency Injection container for the application. The stacktrace: [26.11.13 10:20:36:339 MSK] 000000a3

JAX-RS Jersey JSON preserve null using annotations

a 夏天 提交于 2019-12-07 02:01:21
问题 How do I have JAXB preserve nulls when receiving a JSON sting that contains a null or "" value. String: {"id":null,"fname":"John","region":""} returns Object: Person { Integer id = 0 String fname = "John" Region regions = 0 } I would like it to return null instead of 0 Here is what I have so far: @Provider public class JAXBContextResolver implements ContextResolver<JAXBContext> { private JAXBContext context; private Class<?>[] types = {Person.class}; public JAXBContextResolver() throws

exception java.lang.ClassNotFoundException: com.sun.jersey.spi.container.servlet.ServletContainer

非 Y 不嫁゛ 提交于 2019-12-07 01:34:32
问题 I just made my first REST api based on this http://www.vogella.com/articles/REST/article.html I am using eclipse kepler, tomcat7, and Jersey when I try to "Run on server" I get this error: SEVERE: Servlet /de.vogella.jersey.first threw load() exception java.lang.ClassNotFoundException: com.sun.jersey.spi.container.servlet.ServletContainer at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714) at org.apache.catalina.loader.WebappClassLoader.loadClass

Jersey + Jackson deserialization failure with date object

六眼飞鱼酱① 提交于 2019-12-07 01:12:08
问题 I'm using jersey and jackson together to develop my REST API, and I'm having a problem when deserializing a date string. I have register a provider class in Jersey: @Provider public class MyJsonProvider extends JacksonJsonProvider { public static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss"; @Override public void writeTo(Object value, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String,Object> httpHeaders, OutputStream entityStream) throws

HTTP Status 403 - Invalid CSRF Token '9ee6949c-c5dc-4d4b-9d55-46b75abc2994' was found on the request parameter '_csrf' or header 'X-CSRF-TOKEN'

冷暖自知 提交于 2019-12-07 00:27:27
I am developing a web application which has a front-end with angularjs and a back-end with spring-security and jersey. I am trying to implement spring-security. I can authenticate the user. But I stucked at the logout point. I am sending the X-CSRF-TOKEN within a value, but it seems that spring-security is refusing it. web.xml <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd" > <web-app> <display-name>M2Carros</display-name> <context-param> <param-name>contextConfigLocation</param-name> <param-value> classpath

How to get IP from ContainerRequestContext JERSEY 2.1?

僤鯓⒐⒋嵵緔 提交于 2019-12-06 23:03:05
问题 My code is this: public void filter(ContainerRequestContext request) throws IOException { // can I get Ip from request????? } How can I get ip address from request ? 回答1: According to this JIRA ticket, based on this discussion, they added support for injecting the HttpServletRequest into your filter, a code snippet from the above JIRA looks like this: public class MyRequestFilter implements ContainerRequestFilter { @Context private HttpServletRequest servletRequest; You can then use the

Tweak loading times of Jersey over AppEngine

空扰寡人 提交于 2019-12-06 22:34:01
问题 my application service is not able to start or respond to even warmup requests as the time taken by Jersey to scan the libraries is inordinate. I have created application and hardcoded all the paths of the Resources for jersey. <servlet-name>Jersey REST Service</servlet-name> <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class> <init-param> <param-name>javax.ws.rs.Application</param-name> <param-value>com.livily.rest.JerseyApplication</param-value> </init-param