jersey

Write proxy/wrapper class for own service in jersey

只愿长相守 提交于 2019-12-10 17:49:21
问题 I want to access a full rest service with basic http auth running. However there is no way to for the javascript browser client to suppress the authenticate box when a wrong credential is provided. I thought about different methods to solve this problem someone suggested to remove the WWW-Authenticate Header with a filter (i dont think this is a clean approach) i could rewrite my app to not use Basic Http Auth at all (i think this is too much trouble) i could write a proxy that talks to my

jersey.server.model.ModelValidationException

戏子无情 提交于 2019-12-10 17:36:14
问题 Hello I have some problem with this code! I got this error: Please Help! org.glassfish.jersey.server.model.ModelValidationException: Validation of the application resource model has failed during application initialization. [[FATAL] A resource model has ambiguous (sub-)resource method for HTTP method GET and input mime-types as defined by"@Consumes" and "@Produces" annotations at Java methods public java.lang.String jersey.JerseyTesting.getName() and public java.lang.String jersey

Is it correct that Jersey does not support declarative hyperlinking in nested resources?

非 Y 不嫁゛ 提交于 2019-12-10 17:35:45
问题 public class Widget { @Ref(resource=WidgetResource.class) URI url; ... public URI getUrl() { return url; } public Wonkle getWonkle() { return wonkle; } } public class Wonkle { @Ref(resource=WonkleResource.class) URI url; public URI getUrl() { return url; } ... } The JSON representation of the the Wonkle type has a url attribute with an appropriate value. However, when the Wonkle is used as a nested attribute in the Widget type, its url attribute has a null value. Am I doing something

Gradle jar with jersey dependencies produces MessageBodyReader not found for media type=application/json

大城市里の小女人 提交于 2019-12-10 17:31:46
问题 I've written a Jersey client which communicates with a 3rd party service and it works if I run it from Eclipse but it throws a MessageBodyProviderNotFoundException if I run the jar file. My build.gradle: // Apply the java plugin to add support for Java apply plugin: 'java' version = '1.0' // In this section you declare where to find the dependencies of your project repositories { jcenter() } //create a single Jar with all dependencies task createJar(type: Jar) { manifest { attributes

Consuming JSON in neo4j server extension

混江龙づ霸主 提交于 2019-12-10 17:13:56
问题 I'm building a Neo4j (2.2.2) unmanaged extension and I can't figure out why the following method is throwing 415: unsupported media type when I post requests with properly-formatted JSON bodies and Content-Type:application/json headers. @POST @Path("/create") @Consumes(MediaType.APPLICATION_JSON) public Response createFoo(FooBar input) { //not relevant } This is the FooBar class I want the JSON to be mapped to: @XmlRootElement public class FooBar implements Serializable { String title; public

Synchronous Jersey Rest service that initiates a background task?

点点圈 提交于 2019-12-10 17:09:33
问题 This is the issue I encounter, which is design and implementation related : I have a REST web service that accepts POST requests. Nothing special about it. It currently responds synchronously. However, this web service is going to initiate a background process that may take some long time. I do not want this service to respond 30 minutes later. Instead, it should immediately return an ack response to the client, and nothing more (even after 30 minutes, there will be no more information to

Jersey: MessageBodyReader not found for media type=multipart/form-data

眉间皱痕 提交于 2019-12-10 17:01:43
问题 I have found a few questions like this on SO already but none of them seemed to address my particular problem, and I have been unable to find a solution on my own. Here is the error I'm getting: Caused by: org.glassfish.jersey.message.internal.MessageBodyProviderNotFoundException: MessageBodyReader not found for media type=multipart/form-data; boundary=----WebKitFormBoundaryHWk1XUaeu7pEiDth, type=class org.glassfish.jersey.media.multipart.FormDataMultiPart, genericType=class org.glassfish

Jersey on Jetty on Android throws ContainerException: “No WebApplication provider is present”

妖精的绣舞 提交于 2019-12-10 16:47:44
问题 I'm trying to run Jersey on Jetty on Android. I've created an Android that instantiate a Jetty Server with a Jersey Servlet. Anyway when I start Jetty and visit a REST resource (in my case: http://192.168.1.12:8080/api/hello ) I get a ContainerException with message: No WebApplication provider is present (see exception stack trace below). Any idea why? I've added javax package JNDI to the project since it was required by either Jetty or Jersey. Android doesn't like imporitng javax libraries

Jersey/JAXB: Use same POJO for HTTP POST and GET, but return only a subset of the properties for GET in JSON response.

穿精又带淫゛_ 提交于 2019-12-10 16:40:09
问题 This seems like another fairly simple thing to do, but I'm again struggling on how to do it. I have a POJO, with Jersey/JAXB annotations that has HTTP POST and GET methods associated to it. When doing POST on the POJO, the request body is sent as a JSON, essentially modeling the POJO. When doing GET, I want to return the POJO, but with only a subset of the POJO properties. I tried using @XmlTransient on the properties I don't want for the GET, but then I cannot use those properties during the

java.net.SocketTimeoutException on embedded tomcat with jersey

我的未来我决定 提交于 2019-12-10 16:35:01
问题 My server application use embedded tomcat with Jersey. From time to time I'm getting the following error: 02-03-2014 10:06:05 [com.sun.jersey.spi.container.ContainerResponse] [http-nio-8243-exec-4] [ERROR] - The exception contained within MappableContainerException could not be mapped to a response, re-throwing to the HTTP container java.net.SocketTimeoutException at org.apache.tomcat.util.net.NioBlockingSelector.read(NioBlockingSelector.java:191) at org.apache.tomcat.util.net.NioSelectorPool