FAQ Database Discussion Community


How to get instance of javax.ws.rs.core.UriInfo

java,unit-testing,jax-rs,jersey-2.0,grizzly
Is there any implementation of javax.ws.rs.core.UriInfo which I can use to create an instance quickly for testing. This interface is long, I just need to test something. I don't want to waste time on whole implementation of this interface. UPDATE: I want to write a unit test for a function...

hk2 Dependency Injection on Tomcat

java,dependency-injection,jersey,jersey-2.0,hk2
I am trying hard to get some kind of (c)di work for my little web application. I gave up using Weld and now i am trying hk2 (it is already used by jersey 2). Here is my service that tries to inject something: @ManagedBean @Path("excelExport") public class ExcelExportService { @Inject...

Jersey and HK2 - Injecting current user

java,rest,jersey,jersey-2.0,hk2
I'm working with jersey 2.17 and hk2 to create a simple rest app. I have a ContainerRequestFilter that rejects any request that doesn't have the "currentuser" cookie. I have something like this: @Path("/users") public class UserResource { private UserService userService; @GET @Path("/orders") @Produces("application/json") public List<Order> findOrdersOfCurrentUser() { // some ugly...

Jersey Update Entity Property MessageBodyWriter

java,rest,jersey,jax-rs,jersey-2.0
I want to create a Jersey provider (MessageBodyWriter) that update a dto object property and continue the chain to Jersey-json default provider an return the json object. the problem is that looks like default provider is not called so the output of my rest service become empty as soon as...

How to configure Jersey (javax.ws.rs.*) to reuse ssl sessions

java,ssl,jax-rs,jersey-2.0,keep-alive
I have written a test client that sends requests over TLS using the Jersey library. I am having a hard time trying to figure out how to configure/code the Jersey client such that it reuses the SSL sessions so that I could make my tests faster. The Jersey client by...

NoSuchMethodError when trying to create a WebClient on Glassfish

maven,jersey,apache-httpclient-4.x,htmlunit,jersey-2.0
I'm trying to create a HtmlUnit WebClient in order to parse an Ember app webpage inside a Java EE Servlet filter on a Glassfish server. servlet code: final WebClient webClient = new WebClient(); // causes error HtmlPage page = webClient.getPage(originalUrl); pom.xml <build> <plugins> <plugin> <groupId>org.codehaus.enunciate</groupId> <artifactId>maven-enunciate-plugin</artifactId> <version>1.29</version> <executions> <execution> <goals>...

Hibernate lazy initilizer issue in glassfish jersy with codehus jackson rest service

hibernate,glassfish,jersey-2.0
I am working on glashfish jersey rest services with codehus-Jackson for json data. But i am getting Hibernate lazy initialization exception for that i have added the lazy=false for all child classes. But it was giving infinite recursion error. So i have added JsonIgnore on reverse mapped properties. But it...

Jersey 2.x Custom Injection Annotation With Attributes

java,jersey,jersey-2.0,dropwizard,hk2
I am in the process of migrating from DropWizard 0.7.1 to 0.8.1. This includes migrating from Jersey 1.x to 2.x. In my implementation that uses Jersey 1.18.1, I had a MyProvider (changed all class names for simplicity's sake) that implements InjectableProvider. This class would create MyInjectable objects, containing the custom...

Jersey - JerseyTest: Error reading entity from input stream

jersey,jersey-2.0,jersey-client
I have created a test project in order to learn Jersey. I have created the following classes Book.java (Model), BookDao.java, BookResource.java and so far everything works just fine. My problem is with a JerseyTest i am trying to run (BookResourceTest.java). I am using Jackson for JSON serialization. When i run...

Hibernate validation with custom messages in property file

spring,bean-validation,jersey-2.0,hibernate-validator
Hi am using hibernate validator in jersey rest service. Here how can we pass value to the property file message as follows empty.check= Please enter {0} here in {0} i need to pass the value from annotation @EmptyCheck(message = "{empty.check}") private String userName here in the {0} i need to...

Jersey version issue: MessageBodyReader not found for media type=application/xml

jersey,jersey-2.0,jersey-client
While writing a simple Jersey client that was consuming XML data, I came across this exception "MessageBodyReader not found for media type=application/xml". All of my settings, including the jersey-client as maven dependencies was just fine. The version that I was using was 2.17. Once I degraded the version to 2.15...

Jersey: Injecting of shared object not working with Jetty

java,rest,dependency-injection,jersey-2.0
We want to implement a REST-Service on a Jetty, that receives a Heartbeat from multiple Clients and these Heartbeats are stored in a Hashmap to work with them in further functionallities. Thats how the code looks like at the moment: The class that should be injected. public class SharedMemory {...

How to write Unit Test for this class using Jersey 2 test framework

java,unit-testing,rest,jersey,jersey-2.0
I am trying to write unit test for a Rest api call which is having a POST method for adding a video file to web based application using Jersey2. Here is the signature of the method of my class(TemplateController.java) for which I want to write unit test: Here is my...

Jax-rs -jersey Cross Origin request enablement

java,tomcat,jax-rs,cors,jersey-2.0
I am trying to make my very first jersey rest api, using version 2.X but i have a problem about CORS. Before configuration files, this is my curl output: curl -i http://localhost:8080/camp/rest/user/register HTTP/1.1 200 OK Server: Apache-Coyote/1.1 Content-Type: application/json Content-Length: 32 Date: Sat, 07 Feb 2015 15:34:28 GMT From browser...

Jersey 2 AnnotatedClassVisitor has interface jersey.repackaged.org.objectweb.asm.ClassVisitor as super class

java,jersey-2.0
I keep getting this error when migrating to Jersey 2. At fist I though it is some Maven issue but it does not looks like that. I keep getting: AnnotatedClassVisitor has interface jersey.repackaged.org.objectweb.asm.ClassVisitor as super class my Maven look like that: <dependency> <groupId>org.glassfish.jersey.core</groupId> <artifactId>jersey-client</artifactId> <version>2.15</version> </dependency> <dependency> <groupId>org.glassfish.jersey.core</groupId>...

HK2 is not injecting the HttpServletRequest with jersey

java,dependency-injection,jersey,jersey-2.0,hk2
I am trying to follow the example located here to create a factory in order to inject my HttpSession. Unfortunately no matter what I try it is not working. Not sure what could be the issue. I have tried injecting just the HttpServletRequest and a provider. Here is my example...

How are Jersey @Consumes endpoints matched?

java,rest,jersey,jax-rs,jersey-2.0
I am designing a RESTful endpoint to receive files. I would like to it to accept POSTing as both plain file/stream and multipart. Is there a rule how are endpoints matched by the servlet container? Would the code below work reliably, or is this implementation specific? Can I get away...

ApacheConnectorProvider with Jersey for SSL throws Error

spring,apache,rest,ssl,jersey-2.0
I am trying to post a service call using the SSL URL. I am getting an exception. javax.ws.rs.ProcessingException: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at org.glassfish.jersey.apache.connector.ApacheConnector.apply(ApacheConnector.java:517) at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:246) at...

Jersey MessageBodyWriter not found for media type=text/plain

java,rest,glassfish,jersey,jersey-2.0
I'm trying to follow the Jersey docs to enable a non-200 response if an error occured (https://jersey.java.net/documentation/latest/representations.html#d0e3586) My code looks like : @POST @Produces(MediaType.TEXT_PLAIN) @Consumes(MediaType.APPLICATION_FORM_URLENCODED) public ResponseBuilder getData(@FormParam("one") String one,@FormParam("two") String two,@FormParam("three") String three) { if(one.isEmpty() || two.isEmpty() || three.isEmpty()) { logger.error("Missing params for getData"); throw new WebApplicationException(501); } return...

Dependency Injection in jersey 2.17

java,jax-rs,cdi,jersey-2.0
I have a resource class @Path("/rest") public class DemoResourceController { @Inject DemoService demoService; @Path("/get/demo") @GET @Produces(APPLICATION_JSON) public Response getDemoLists() { List<String> demoList=demoService.getDemoList(); return Response.ok(demoList).build(); } I tried the answers in the post Dependency injection with Jersey 2.0 if i use compile group: "org.glassfish.jersey.ext.cdi" , name: "jersey-cdi1x" , version: "2.17" compile...

Does HK2 support FieldInterceptor?

java,jersey-2.0,hk2
I have been digging and it looks like it doesn't support doing AOP on fields. I have looked at the examples here but the InterceptionService does not seem to support FieldInterceptor. I was looking to do some simple bean validation using a custom field annotation. public Response createCustomer(@Validated final Customer...

Parse: Unauthorized in REST API

java,rest,parse.com,jersey-2.0
I'm trying to send a push notification from my Java code consuming the Parse REST API with Jersey. Client client = Client.create(); WebResource webResource = client.resource("https://api.parse.com/1/push"); //My real id instead of XXXXXXXXXXXXXXXXXXXXXXXX webResource.header("X-Parse-Application-Id", "XXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); //My real key instead of XXXXXXXXXXXXXXXXXXXXXXXX webResource.header("X-Parse-REST-API-Key", "XXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); Map<String, Object> postData = new LinkedHashMap<>();...

MOXy is only marshaling base class members in a collection

java,collections,jersey,jersey-2.0,moxy
I have a base class declared something like: package com.mystuff.surrogates; import java.io.Serializable; import java.util.UUID; public class BaseClass implements Serializable { private UUID id; private String name; public UUID getId() { return this.id; } public void setId(UUID id) { this.id = id; } public String getName() { return thisname; } public...

Probleme with my Servlet and @FormDataParam Jersey

java,rest,jersey,multipartform-data,jersey-2.0
I have a problem with my web-services using Jersey. I have a form composed of two inputs, one of type "file" and one of type "text". The problem is that when I only use the input of type "file", everything works fine, but when I add the second one, of...

Jersey Maven quickstart archetype in Eclipse

java,maven,jersey,jersey-2.0,maven-archetype
I am trying to create Jersey normally with the aid of maven but I am always getting this structure as in the scrennshoot and without error as normally?! It does not look as Jersey commonly layout. I am using this one: org.glassfish.jersey.archetypes jersey-quickstart-webapp 2.16 pom.xml: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">...

How to use SSL with Jersey 2.x and Apache Connection manager

apache-httpclient-4.x,jersey-2.0,jersey-client
I would like to use connection pooling with my Jersey 2.x rest clients. I have the following code: ClientConfig clientConfig = new ClientConfig(); PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(); connectionManager.setMaxTotal(100); connectionManager.setDefaultMaxPerRoute(20); clientConfig.property(ApacheClientProperties.CONNECTION_MANAGER, connectionManager); clientConfig.connectorProvider(new ApacheConnectorProvider()); Client client = ClientBuilder.newBuilder()...

Limit path media type mappings in Jersey

java,jersey,mapping,jersey-2.0,media-type
I have configured MEDIA_TYPE_MAPPINGS for my Jersey apps. Unfortunately, this causes some trouble with a generic upload service in my app. @PUT @Path("files/{filename}") @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) public Response uploadFile( @PathParam("filename") @NotNull @Size(max = 240) String filename, DataSource dataSource) If someone uploads .../files/file.xml the extension is chopped of. Is there...

Dropwizard 0.8.0 WADL support

jersey-2.0,dropwizard,wadl
Wadl can be configured in Dropwizard 0.7.1 like this: environment .jersey() .getResourceConfig() .getProperties() .put(ResourceConfig.FEATURE_DISABLE_WADL, Boolean.FALSE);//Create WADL How can I set it in Dropwizard 0.8.0...

Catch json processing exception with dropwizard?

java,json,jackson,jersey-2.0,dropwizard
I have a dropwizard application with a global exception handler registered that implements ExceptionMapper<Throwable>. If I throw any runtime exception from within a resource the mapper gets hit. However, in a test I am posting JSON to to a resource with a missing type discriminator for a jackson polymorphic type....

Maven dependency for testing using Jersey Test Framework

maven,jersey,jersey-2.0,jersey-client,jersey-1.0
I am trying to test a Restful service using Jersey Test Framework , I have the following code in place. import java.io.UnsupportedEncodingException; import java.net.URISyntaxException; import java.net.URLEncoder; import javax.json.JsonException; import org.junit.Test; import com.sun.jersey.api.client.WebResource; import com.sun.jersey.test.framework.*; import com.sun.jersey.test.framework.AppDescriptor; import com.sun.jersey.test.framework.JerseyTest; import com.sun.jersey.test.framework.WebAppDescriptor; public class MakeSureTest...

Preventing XSS attacks in Jersey with XML Content-Type

xml,security,java-ee,jersey-2.0
I am having Jersey REST service with Content-Type as JSON. For this I have used AntiSamy to filter XSS attacks. Now I need to support XML Content-Type, AntiSamy considers XML as a threat and all my requests are thrown as attack. How to support XML as a Content-Type and avoid...

Jersey 2 (JAXB) XML element case with list not honoring XmlRootElement

xml,jaxb,jersey,jersey-2.0
We just upgraded a service from Jersey 1.x to 2.10.x and are seeing some unexpected behavior. We have a class like this that is annotated to marshal as 'User' instead of 'user': @XmlRootElement(name = "User", namespace = "security.services.pml.com") public class User { @XmlElement(namespace = "security.services.pml.com", required = true) protected String...

Initializing filter with values from application.properties

java,tomcat,spring-boot,servlet-filters,jersey-2.0
I want to secure my REST API (jersey2) based on IP addresses, but without having the trouble of Spring Security and so on. I simply need to whitelist a few IPs that are granted full access rights. To implement this, I thought of putting the IPs into the application.properties and...

MultiException when custom jersey param throws exception

java,jax-rs,jersey-2.0,dropwizard
NOTE: All code to reproduce this problem is available at https://gist.github.com/SrikanthRao/c9fc35e6fe22a74ab40c http://localhost:8080/date/bean?date=2014-13-23 (using BeanParam) produces "{"code":500,"message":"There was an error processing your request. It has been logged (ID 48be9aa43bd49547)."}" without adding MultiExceptionMapper to jersey. If I add MultiExceptionMapper to jersey, the above url results in "Date is either not in YYYY-MM-DD...

Using SelectableEntityFiltering in Jersey 2.17

java,filter,jersey,jackson,jersey-2.0
I am new in Jersey and i try to use the SelectableEntityFilteringFeature from the example: http://blog.dejavu.sk/2015/02/04/jerseys-entity-filtering-meets-jackson/#selectable I create a small service with the following classes/files: a resource file called PersonResource.java import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import org.glassfish.jersey.jackson.JacksonFeature; import org.glassfish.jersey.message.filtering.SelectableEntityFilteringFeature; import org.glassfish.jersey.server.ResourceConfig;...

Cannot integrate Jersey 2.16 into Tomcat 8.0.12 using servlet 3 plugability feature

java,tomcat,jersey,jersey-2.0,servlet-3.0
In new project I decided to use latest Jersey (2.16) with Tomcat 8, but integration scheme described in documentation causes Tomcat to throw NPE: java.lang.NullPointerException org.apache.catalina.loader.WebappClassLoader.binaryNameToPath(WebappClassLoader.java:2503) org.apache.catalina.loader.WebappClassLoader.findLoadedClass0(WebappClassLoader.java:2708) org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1215) org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1173)...

Jersey serializing null values to json : How to skip

java,json,spring,serialization,jersey-2.0
I am using Jersey 2.4 with spring. When I am returning a response from a method with an annotation @Produces(MediaType.APPLICATION_JSON) on it, it also serialize the null values to json. I don't want to serialize the fields that contains the null values. Is there any solution for the same?...

Anonymous access of method from Jersey webservice which is secured with spring security and oAuth2

spring,spring-security,jersey-2.0,jersey-client,spring-security-oauth2
I have one Jersey Rest web service which handles person account CRUD. I have spring security+ oAuth2 to secure this api , what i am not able to configure is , i wanted to make anonymous of Account create method. i tried to configure intercept url but it does not...

How to debug Jersey 2.x Client Api

java,client,jersey-2.0
I need to see the content of Jerset 2.x Client API post requests before it is sent. I found this: jersey.api.client.WebResource - how to debug/log the request headers But its related to Jersey 1.x Thanks...

Jersey 2.8, grizzly, SSE: what jar files do i have to download

java,rest,jersey-2.0,grizzly
aI am trying to upgrade my jersey-jar files from 1x to 2.8 version. To download them, everyone is pointing here. Obviously, i can download and import all of them but i believe that 5-6 should be sufficient for me. I have searched but i did not find something that says...

Jersey 2 POST and PUT parameter is null

java,jax-rs,jersey-2.0
I have a problem with my jersey rest service when method is PUT or POST. The problem is that parameter is null. I test with angularjs and jersey-test-framework with same result, the parameter is null. I thought the problem was due to the header "Content-Type" but I add this in...

Java Jersey PathParams Checking and NotFoundException custom message

java,rest,exception-handling,jax-rs,jersey-2.0
I am using Jersey for rest API, JerseyTests to unit test. I have been following what seems to be conventional practice over the internet for PathParams checking and Exception Handling, but I don't quite understand what I am doing wrong here: RoomApplicationResource.java @Path("demandes") public class RoomApplicationResource { @GET @Path("/{email}/{requestNumber}") public...

Jersey JAX-RS 3 level nested object has null value

jaxb,jersey,jax-rs,jersey-2.0
I have the below JSON code that needs to be parsed. I'm using the corresponding JAX-RS models. The problem is that the paymillClient object is null. If I add currency as a string inside the PaymillSubscription object, it returns EUR value, not null. So there appears to be a problem...

Asynchronous RestAPIs with RxJava/Jersey2. Threading questions?

java,asynchronous,jersey-2.0,reactive-programming,rx-java
We are in the process of prototyping a REST API using reactive programming. As shown in the diagram, we keep 3 layers same as we used in our previouse sync API designs ; http://oi59.tinypic.com/339hhki.jpg API Layer implemented using Jersey2 which will process request/deserialize JSON and handover to Service Layer. Service...

Unable to consume Jersey Webservice

java,web-services,jax-rs,jax-ws,jersey-2.0
I try to consume Jersey-2 webservice using postman. below my webservice @Path("UserService") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public class UserService { @POST @Path("/getUser") public Utilisateur getUser(@FormParam("identitifiant")String identifiant,@FormParam("password") String password) { UtilUtilisateur myUser = null; try { myUser = requestUser(identifiant, password); } catch (Exception t) { log(t); } return myUser; } Below my web.xml...

Jonas - Spring - Jersey REST - Bean Validation : ValidationException: No Validation Provider Found

spring,rest,bean-validation,jersey-2.0,jonas
I'm building a REST webservice application using Jonas 5.2.4, Jersey 2.15, Spring 4.13. 'til this point everything's allright. The application compile, deploy and react as expected. Then I've tryed to add Bean Validation (JSR-303) of input rest resources fellowing thoses indications/exemples: https://jersey.java.net/documentation/latest/bean-validation.html or http://blog.trifork.com/2009/08/04/bean-validation-integrating-jsr-303-with-spring/ when I add the validation dependencies...

Running Jersey with Grizzly

java,jersey-2.0,grizzly
I am trying to use Jersey with Grizzly as self-hosting Basically my main is: org.glassfish.jersey.server.ResourceConfig rc = new ResourceConfig(); rc.registerClasses(DummyController.class); webServer = GrizzlyHttpServerFactory.createHttpServer(uri, rc, false); System.out.println("Server Created"); try { webServer.start(); System.out.println("Server Started"); } catch (IOException e) { } I have created a small Controller: @Path("/") public class DummyController { @GET...

Is it possible to use Jersey CDI in any JavaSE application?

java,dependency-injection,jersey,jersey-2.0,hk2
I have a interface here interface Idemo{ public int getDemo(int i); } And it's one implementation class DemoImpl implements Idemo{ @Override public int getDemo(int i){ return i+10; } } And there is a class which has a dependency on Idemo class Sample{ @Inject Idemo demo; public int getSample(int i){ return...

Jackson not consuming the JSON root element

web-services,rest,jackson,jersey-2.0
I'm using JAX-RS + Jersey to consume the web-service request and Jackson to translate JSON data: @Path("/") public class JAXRSRestController { @Path("/jsonRequest") @POST @Consumes(MediaType.APPLICATION_JSON) public Response submitJsonRequest(SampleObject sampleObject, @Context HttpHeaders headers) { Ack ack = new Ack(); ack.setUniqueId(sampleObject.getId()); ack.setType(sampleObject.getName()); return Response.ok().entity(ack).build(); } } Here if the request is in the...

Jersey Client, memory leak, static and concurrency

java,concurrency,jersey,jersey-2.0,jersey-client
I am using Jersey Client (v2.17) to make external calls from my app. I found out this memory leak bug (the CPU consumption was very high) which made me re-write my code to make the client static like this: public class GeneralUtil { private static final Client client = ClientBuilder.newClient()...

How do I get a reference to the Jackson Object Mapper in a jersey2 / hk2 application

java,json,dependency-injection,jersey-2.0,hk2
I have a jersey2 application configured for JSON support via Jackson, adding <dependency> <groupId>org.glassfish.jersey.media</groupId> <artifactId>jersey-media-json-jackson</artifactId> <version>${jersey.version}</version> </dependency> in the POM file and public MyApplication() { ... register(JacksonFeature.class) ... } in my application. Everything works, my resources get deserialized POJOs as arguments @POST @Consumes(MediaType.APPLICATION_JSON) public void blah(MyPojo p) { ... }...

Unable to resolve any beans for Types [org.glassfish.jersey.message.filtering.spi.ObjectProvider]

java,json,jackson,jersey-2.0,wildfly-8
trying to move from Moxy to Jackson json media provider for my Jersey web service and found couple of issues which I can't resolve so far: first of all moxy was working fine for the same piece of code, but because we are using jackson everywhere in other projects I...

No object available for injection error when using bindFactory

java,dependency-injection,jersey,jersey-2.0,hk2
I have the following implementation for a Jersey (2.18) application: public class RootApplication extends ResourceConfig { public RootApplication() { packages("com.foo.bar"); register(new AbstractBinder() { @Override protected void configure() { bindFactory(RepositoryFactory.class).to(Repository.class); // if I use following line instead of bindFactory it works // bind(OracleRepository.class).to(Repository.class); } }); } public class RepositoryFactory implements Factory<Repository>...

NoSuchMethodError on startup in Java Jersey app

java,maven,jersey,jax-rs,jersey-2.0
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 version is being loaded, I think?...

Java Restful Service eclipse tomcat HTTP Error 404

java,rest,tomcat,jersey,jersey-2.0
i try to keep up with a java rest service. So i found some tutorials, which explain always the same way. But i cant get this running :(. I made Dynamic Web Project in Version 2.5 and Tomcat 7.0 in eclipse. Then i load following jars to WEB-INF/lib My Projectname...

Is it possible to construct an object partially with Spring DI and partially with Jersey DI?

spring,dependency-injection,jersey,jersey-2.0,hk2
I have a class JerseyWebService which uses Jersey DI to inject dependency @Path("/baskets") public class JerseyWebService { @Inject ExternalApiServiceInterface api; ... } The dependency is specified in the binder public class CustomBinder extends AbstractBinder { @Override protected void configure() { bind(ExternalApiService.class).to(ExternalApiServiceInterface.class); ... } But the problem here is that ExternalApiService...

Jersey: disable default JSON provider

java,jersey,jackson,jersey-2.0
i am using Jersey 2.17, JSON and automatic feature discovery. I have my custom JSON Provider extending JacksonJsonProvider. It's annotated with @Provider and automatically registerd, same as default one that comes with: <dependency> <groupId>org.glassfish.jersey.media</groupId> <artifactId>jersey-media-json-jackson</artifactId> </dependency> I want to disable/exclude default one without giving up on feature scanning/manually registering everything....

What's the right way to bootstrap Jersey 2 (with Jetty)?

jersey,jetty,jersey-2.0,embedded-jetty,hk2
I've managed to hack my way to a working Jersey/Jetty setup with HK2 injection, but given the vast number of somewhat confusing (and at times inconsistent) docs I'm finding, I'm not sure if I've missed some salient detail of getting it right.. As it stands, I'm bootstrapping the servlet like...

How do I create a simple JSON Jersey 2.x RESTful web service on Glassfish 4?

json,rest,glassfish,jackson,jersey-2.0
I've spent days trying to figure this out. All I want to do is create a simple web service to return Lists of POJOs as JSON. Why is this so difficult? I'm starting with this in my POM: <dependency> <groupId>javax</groupId> <artifactId>javaee-web-api</artifactId> <version>7.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.glassfish.jersey.containers</groupId> <artifactId>jersey-container-servlet</artifactId>...