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
22
votes
2 answers

Can I change the property path in a ConstraintValidator for Method arguments?

If you are familiar with the Bean Validation Framework you know that you cannot get the name of a method argument. So if you do a @NotNull constraint on the first argument of a method and the validation fails the getPropertyPath will be something…
robert_difalco
  • 4,821
  • 4
  • 36
  • 58
22
votes
1 answer

Using Jersey 2.0, how do you register a bindable instance per request?

...if the instance needs to be constructed manually, perhaps by a 3rd party factory class? Previously, (Jersey 1.x), you would do something like this: public class MyInjectableProvider extends PerRequestTypeInjectableProvider
Shaun
  • 2,490
  • 6
  • 30
  • 39
21
votes
5 answers

java.lang.NoSuchMethodError: javax.ws.rs.core.Application.getProperties()Ljava/util/Map;

I am unable to find answer through the following links One Two Three Following is my pom.xml dependency com.amazonaws aws-java-sdk
Salman Shaikh
  • 575
  • 1
  • 7
  • 24
20
votes
1 answer

What is the relationship between Jersey, JAXB, JAX-RS, Moxy, Jackson, EclipseLink Moxy, json and xml?

I am coming from Node.js background and have quite a good understanding of RESTful web services. Now I am trying to build RESTful web services using Java. I understand core Java but completely new to Java based web development. I come to conclusion…
Harshal Patil
  • 17,838
  • 14
  • 60
  • 126
20
votes
17 answers

Why would "java.lang.IllegalStateException: The resource configuration is not modifiable in this context." appear deploying Jersey app?

I have created an app implementing REST services locally using: Eclipse Indigo Jersey 2.4 Tomcat 7.0.47 When running locally using Eclipse, the services work OK, but when deploying my WAR file, I get the following exception when trying to do a GET…
Ghasfarost
  • 742
  • 2
  • 8
  • 17
19
votes
3 answers

Spring-Boot Jersey: allow Jersey to serve static content

The application uses JDK 8, Spring Boot & Spring Boot Jersey starter and is packaged as a WAR (although it is locally run via Spring Boot Maven plugin). What I would like to do is to get the documentation I generate on the fly (at build time) as a…
fbiville
  • 8,407
  • 7
  • 51
  • 79
19
votes
1 answer

Set Query Parameters on a Jersey Test Call

I have a Jersey based Java servlet: @Path("foo") class Foo { @GET @Path("bar") public Response bar(@QueryParam("key") String value) { // ... } } I can call it in Tomcat just fine…
kwiqsilver
  • 1,017
  • 2
  • 11
  • 24
19
votes
2 answers

Jersey 2 Multipart upload Client

I want to write a simple jersey 2 client to upload a file. I'm using Jersey 2.10.1 and wrote following server code: @POST @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces(MediaType.APPLICATION_JSON) public Response uploadFile( …
Nicklas2751
  • 802
  • 1
  • 9
  • 22
18
votes
3 answers

Use of Thread.currentThread().join() in Java

The following code is taken from an example in the Jersey project. See here. public class App { private static final URI BASE_URI = URI.create("http://localhost:8080/base/"); public static final String ROOT_PATH = "helloworld"; public…
ksl
  • 4,519
  • 11
  • 65
  • 106
18
votes
7 answers

How to add a http proxy for Jersey2 Client

It's easy to set a proxy for client on Jersey1.x: config.getProperties().put(ApacheHttpClientConfig.PROPERTY_PROXY_URI, proxyUrl); But how to add a http proxy for Jersey2.x client? I checked the source code and didn't find the implementation does…
feuyeux
  • 1,158
  • 1
  • 9
  • 26
17
votes
1 answer

Why does HK2 repackage everything?

I've recently switched from Jersey 1 to Jersey 2 for some projects I work on. The biggest annoyance I've run across with Jersey 2 is that it uses HK2, which for some reason repackages standard Maven artifacts. To avoid potential annoying-to-debug…
M. Justin
  • 14,487
  • 7
  • 91
  • 130
17
votes
4 answers

jersey 2: How to create custom HTTP param binding

I am trying to create a custom http param binding for my restful service. Please see the example below. @POST @Path("/user/{userId}/orders") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public MyResult…
yzandrew
  • 785
  • 1
  • 11
  • 25
16
votes
3 answers

Registering JacksonJsonProvider with ObjectMapper + JavaTimeModule to Jersey 2 Client

I'm trying to marshal response containing ISO formatted timestamp like that: { ... "time" : "2014-07-02T04:00:00.000000Z" ... } into ZonedDateTime field in my domain model object. Eventually it works if I use solution that is commented in…
libnull-dev
  • 881
  • 1
  • 7
  • 19
16
votes
5 answers

POST to Jersey REST service getting error 415 Unsupported Media Type

I am using a JAX-RS web application with Jersey and Tomcat. Get requests are fine however when I try to post JSON I get an HTTP status 415 - Unsupported Media Type. Here is my simple HelloWorld.java: package service; import…
Rob Crocombe
  • 341
  • 1
  • 4
  • 15
15
votes
4 answers

A resource model has ambiguous (sub-)resource method for HTTP method GET and input mime-types as defined by"@Consumes" and "@Produces" annotations

How can the following produce this error when they have different URLs ? @Path("/job/{empId}/empProfile") public EmpProfileResource delegateToEventProfileResource() { EmpProfileResource resource = new EmpProfileResource(); …
shep
  • 513
  • 2
  • 5
  • 17