Questions tagged [jersey-2.0]

Jersey 2.0 is the open source, early access JAX-RS 2.0 (JSR-339) reference implementation for building RESTful Web services. Only use this tag if your question specifically pertains to Jersey 2.0.

Jersey is an open source framework for developing RESTful web services in Java and the reference implementation for JAX-RS 2.0 (JSR-339)

2300 questions
31
votes
2 answers

How to inject an object into jersey request context?

I have this scenario where I want to write a filter and I want this filter to insert some object into the current request and pass it on so that when the resource class gets the request it can use the object. Filter class @Override public void…
armin
  • 1,985
  • 6
  • 38
  • 52
29
votes
2 answers

Jersey: No suitable constructor found for type [simple type, class Thing]: can not instantiate from JSON object

I have a resource with a method like: @PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("/add") public Response putThing(Thing thing) { try { //Do something with Thing object return…
Eduardo
  • 6,900
  • 17
  • 77
  • 121
29
votes
3 answers

Using Jersey-spring with Spring 4.0

According to you what are the risks of using Spring 4 with the jersey-spring3 integration module? I have tried to use Spring 4.0 with the jersey spring example and the example still works but i'm unable to identify risks linked to this usage.
guli
  • 1,183
  • 1
  • 9
  • 19
29
votes
8 answers

How to use guice-servlet with Jersey 2.0?

Is there any sample code demonstrating how to use guice-servlet with Jersey 2.0?
Gili
  • 86,244
  • 97
  • 390
  • 689
28
votes
3 answers

NoSuchMethodError on startup in Java Jersey app

I've been getting a very strange error when trying to start a Jersey app on Tomcat. The same code works on other computers. I tried reinstalling tomcat, all my maven dependencies, even Eclipse and Java itself, no luck. It seems like a bad Jersey…
SGr
  • 853
  • 2
  • 9
  • 15
28
votes
1 answer

how to send json object from REST client using javax.ws.rs.client.WebTarget

I have a POJO given below which I want to PUT to the server as JSON or XML. This is what I have done CLIENT: ClientConfig config = new ClientConfig(); Client client = ClientBuilder.newClient(config); WebTarget target =…
user3275095
  • 1,605
  • 4
  • 24
  • 36
27
votes
1 answer

Migrate Jersey project to use Java 10 results in java.lang.IllegalArgumentException at jersey.repackaged.org.objectweb.asm.ClassReader.

Previously, when the project was on Tomcat 8 and Java 8, it was working fine, but after I migrated my project to Tomcat 9 and Java 10, it is giving me error as follows: Oct 05, 2018 11:02:01 AM org.apache.catalina.core.ApplicationContext log SEVERE:…
Jaydeep Bobade
  • 1,005
  • 2
  • 16
  • 25
27
votes
2 answers

Can't find @FormDataParam in Jersey 2.17

I'm quite new to web services so I've started with basic examples. This one relates to file upload. I'm using latest (2.17) version of Jersey bundle for non-maven developers. It states that: bundle contains the JAX-RS 2.0 API jar, all the core…
Rasa
  • 337
  • 1
  • 4
  • 10
26
votes
5 answers

How do I migrate from Jersey 1.0 to Jersey 2.0?

I'm trying to upgrade to Jersey 2.0 and I'm having a lot of trouble because the groupIds and artifactIds of Jersey have completely changed and I can't find a migration plan in the Jersey docs. Here's what my pom.xml used to look like, and this…
Daniel Kaplan
  • 62,768
  • 50
  • 234
  • 356
23
votes
2 answers

Dynamically (un)deploying resources in Jersey

I need to hot-deploy and -undeploy resources in a Jersey ServletContainer. There seems to be no way to 'unregister' resources on a ResourceConfig, so the route I'm following is to replace all resources with a new set. Although the documentation says…
Brecht Yperman
  • 1,209
  • 13
  • 27
23
votes
1 answer

Catch all Exceptions and also return custom Errors in Jersey

I want to catch all unexpected Exceptions in a jersey rest service. Therefore i wrote an ExceptionMapper: @Provider public class ExceptionMapper implements javax.ws.rs.ext.ExceptionMapper { private static Logger logger =…
Dominic
  • 735
  • 2
  • 8
  • 20
22
votes
1 answer

Jersey RESTful web service gradle setup

I am stuck with creating a gradle project for a RESTful web service using the jersey library. The project configuration should be capable of launching the service inside a jetty application server. I already found a resource:…
ruabmbua
  • 393
  • 1
  • 3
  • 13
22
votes
2 answers

JerseyTest and JUnit throws NullPointerException

I have some problems with the jersey test framework. If i use the @Before and @After annotations, then the target method throws a NullPointerException. I thought JerseyTest works with JUnit? Where is my problem? Jersey: 2.12 JUnit: 4.11 Code that…
Dominic
  • 735
  • 2
  • 8
  • 20
22
votes
5 answers

JAX-RS HATEOAS Using Jersey, Unwanted Link properties in JSON

Since Jersey 2.9, it's been possible to create link relations for hypermedia-driven REST APIs through declarative linking. This code, for example: @InjectLink( resource = ItemResource.class, style = Style.ABSOLUTE, bindings =…
arjaynacion
  • 369
  • 1
  • 4
  • 10
22
votes
1 answer

What is the purpose of including the jersey-bom import scoped dependency in a jersey project?

When generating a jersey based project using the jersey-quickstart-grizzly2 artifact mvn archetype:generate -DarchetypeArtifactId=jersey-quickstart-grizzly2 \ -DarchetypeGroupId=org.glassfish.jersey.archetypes -DinteractiveMode=false…
Salah Eddine Taouririt
  • 24,925
  • 20
  • 60
  • 96