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)

2280 questions
488
votes
2 answers

Best practice for REST token-based authentication with JAX-RS and Jersey

I'm looking for a way to enable token-based authentication in Jersey. I am trying not to use any particular framework. Is that possible? My plan is: A user signs up for my web service, my web service generates a token, sends it to the client, and…
DevOps85
  • 6,265
  • 6
  • 20
  • 39
187
votes
7 answers

Jersey stopped working with InjectionManagerFactory not found

I am receiving below error while running my Jersey API in Tomcat 8.5.11 which is causing my API to stop: HTTP Status 500 - Servlet.init() for servlet Jersey REST Service threw exception type Exception report message Servlet.init() for servlet…
gregor
  • 2,157
  • 2
  • 9
  • 16
111
votes
8 answers

Dependency injection with Jersey 2.0

Starting from scratch without any previous Jersey 1.x knowledge, I'm having a hard time understanding how to setup dependency injection in my Jersey 2.0 project. I also understand that HK2 is available in Jersey 2.0, but I cannot seem to find docs…
donnie_armstrong
  • 1,303
  • 2
  • 10
  • 8
86
votes
17 answers

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

I am trying to build a simple hello world application for two days using Jersey + Google app engine. For simple AppEngine project I followed these tutorials and both works just…
M-WaJeEh
  • 16,562
  • 9
  • 59
  • 93
74
votes
1 answer

What exactly is the ResourceConfig class in Jersey 2?

I have seen a lot of Jersey tutorials that starts with something like @ApplicationPath("services") public class JerseyApplication extends ResourceConfig { public JerseyApplication() { packages("com.abc.jersey.services"); } } without…
Chin
  • 16,446
  • 27
  • 96
  • 148
50
votes
8 answers

MULTIPART_FORM_DATA: No injection source found for a parameter of type public javax.ws.rs.core.Response

I am using Jersey based restful Service implementation strategy to build a service which will be used to upload files. My service class name is : UploadFileService.java (See Code below) package com.jerser.service; import java.io.File; import…
Swarup Saha
  • 755
  • 1
  • 9
  • 20
48
votes
7 answers

Custom ObjectMapper with Jersey 2.2 and Jackson 2.1

I am struggling with a REST application with Grizzly, Jersey and Jackson, because Jersey ignores my custom ObjectMapper. POM dependencies: org.glassfish.jersey.containers
svenwltr
  • 12,872
  • 10
  • 45
  • 62
41
votes
10 answers

Jersey ContainerRequestFilter not triggered

I'm trying to use a ContainerRequestFilter to enforce some authentication on a Tomcat based Jersey application. I followed this document. Problem : the filter is never triggered The filter class : @Provider public class AuthFilter implements…
koyaga
  • 955
  • 1
  • 8
  • 14
36
votes
2 answers

Is java Jersey 2.1 client thread safe?

Documentation for jersey 2.0 says: Client instances are expensive resources. It is recommended a configured instance is reused for the creation of Web resources. The creation of Web resources, the building of requests and receiving of …
jakub.piasecki
  • 536
  • 1
  • 5
  • 12
36
votes
6 answers

Jersey 2.0 equivalent to POJOMappingFeature

I have some experience using Jersey < 2.0. Now I am trying to build a war application to provide a JSON Webservice API. I am now struggling for a considerable amount of time trying to configure Moxy and it seams to be way more complicated than what…
Frederick Roth
  • 2,659
  • 4
  • 24
  • 42
34
votes
3 answers

How I return HTTP 404 JSON/XML response in JAX-RS (Jersey) on Tomcat?

I have the following code: @Path("/users/{id}") public class UserResource { @Autowired private UserDao userDao; @GET @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public User getUser(@PathParam("id") int…
IJR
  • 395
  • 1
  • 5
  • 8
33
votes
5 answers

Listing all deployed rest endpoints (spring-boot, jersey)

Is it possible to list all my configured rest-endpoints with spring boot? The actuator lists all existing paths on startup, I want something similar for my custom services, so I can check on startup if all paths are configured correctly and use this…
Jan Galinski
  • 10,521
  • 7
  • 48
  • 68
33
votes
6 answers

Uploading file using Jersey over RESTfull service and The resource configuration is not modifiable?

@Path("file.upload") public class UploadFileService { @POST @Consumes(MediaType.MULTIPART_FORM_DATA) public Response uploadFile( @FormDataParam("file") InputStream uploadedInputStream, @FormDataParam("file")…
Sami
  • 2,179
  • 11
  • 43
  • 77
31
votes
4 answers

How to get list as response from jersey2 client

I want to know how I can extract a List as response from the jersey-2.0 client. I have already tried this, List list = client .target(url) .request(MediaType.APPLICATION_JSON) …
Saurabh
  • 6,001
  • 3
  • 38
  • 40
29
votes
1 answer

WARNING: The (sub)resource method contains empty path annotation

I have configured rest path like "/v1/" and the endpoint configured in servlet like '/test/'. Now I removed the "/v1" from the java class "Test". org.glassfish.jersey.internal.Errors logErrors WARNING: The following warnings have been detected:…
Brisi
  • 1,653
  • 6
  • 24
  • 38
1
2 3
99 100