Questions tagged [jersey]

Jersey is the open source, production quality, JAX-RS (JSR 311, JSR 339) Reference Implementation for building RESTful Web services.

Jersey is an open source framework for developing RESTful web services in Java and the production-ready reference implementation for JAX-RS 1.1 (JSR-311) and JAX-RS 2.0 (JSR-339). It is included in GlassFish open source application server and WebLogic application server from Oracle, and can be used with other web servers including the lightweight HTTP server included in JDK.

10403 questions
4
votes
1 answer

Enabling JSON using jersey and grizzly

I am playing with Jersey hosted with Grizzly and want to be able to consume and produce JSON, however I am getting 500 from the server in get request and media type unsupported in POST my server code is org.glassfish.jersey.server.ResourceConfig rc…
li-raz
  • 1,678
  • 2
  • 29
  • 57
4
votes
2 answers

How do I (un)marshall a Date as a time-stamp with jackson

I'm having trouble (un)marshalling java.util.Date objects into timestamps. Ideally the timestamps should be in a UTC-0 format and not the server's local time zone. Although I can work around that pretty easily if I need to. NB: I am aware that here…
Anders
  • 125
  • 1
  • 3
  • 13
4
votes
1 answer

HK2 is not injecting the HttpServletRequest with jersey

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…
Chris Hinshaw
  • 6,967
  • 2
  • 39
  • 65
4
votes
1 answer

How to return Response in XML in JAX-RS web service?

I'm developing a REST service using JAX-RS with Java 6 and Jersey 1.8 and my server is JBoss 5.1.0 GA, I've started with a simple endpoint that receives a parameter and return a null value. Following this article, I mapped my expected exceptions…
Uriel Arvizu
  • 1,876
  • 6
  • 37
  • 97
4
votes
1 answer

Moxy can't marshal List into JSON

I have a Tomcat server running a servlet using the Jersey 2.6 framework. Within the servlet, I am using Jackson for JSON <--> POJO marshalling. I've recently learned of Moxy and am trying to switch to it, as it seems to be preferred by…
4
votes
5 answers

Securing REST services in Jersey

I am very much new to web services. I have exposed some REST services using Jersey 2 in integration with Spring. Now I need to secure those rest services using authentication with username/password. I am told not to use Spring Security. I have no…
Anand
  • 20,708
  • 48
  • 131
  • 198
4
votes
1 answer

Mocking a Jersey REST Api running on Grizzly using Mockito

I am having a play with testing a RESTful api which I have set up using Jersey. I want to test it using JUnit while running it with Grizzly to provide the Http container. General testing using the server works ok, i.e. sending requests and…
raghera
  • 633
  • 12
  • 17
4
votes
1 answer

How do I get my Jersey 2 Endpoints to eagerly initialize on startup?

I am porting some code from Jersey 1.x and my implementation of various Health Check endpoints relies on all the @Singleton endpoint resources being initialized at start up so as to be able to detect which checks to do. In Jersey 2.0 - whatever I do…
TiGz
  • 894
  • 2
  • 13
  • 21
4
votes
1 answer

REST Call to Resource in Dropwizard/Jersey and UTF-8 works only on dev machine

We're using dropwizard 0.7.1 which comes with jetty 9.0.7 and the jersey http client 1.18.1 (yes, it's old...). The os is linux, we're using Java 1.8. I'm running an integration test locally inside eclipse, which makes a rest call using jersey to a…
Bernhard
  • 665
  • 1
  • 6
  • 22
4
votes
2 answers

Java Jersey PUT Method and working Client

I am developing an Dynamic Web Application with Eclipse. I have e working MySQL-Database which is connected over a class called 'Data Access Object' (=DAO) that works with JDBC. I want to create entries into this database. The functions are ready.…
silenum
  • 149
  • 1
  • 2
  • 11
4
votes
1 answer

Creating a ResourceConfig that behaves the same way as default Jetty's Jersey registering

I have an endpoint with: @POST @Path("/test") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public String canaryTest(String JSON) { return JSON; } When I register it in Jetty using Jersey ServletHolder holder = new…
Whimusical
  • 6,401
  • 11
  • 62
  • 105
4
votes
2 answers

java/jersey/jackson - validate input JSON

I am writing a REST API with a Java/Jersey/Jackson stack. All JSON parsing and generating is done with Jackson. The REST layer is handled by Jersey. It will be embedded in a Grizzly container. In my API, I accept JSON in my endpoints. For…
user4444533
4
votes
1 answer

Why am i getting 405 Method Not Allowed while doing a POST Request

I am new to the rest services. I am trying to create a service that accepts json string from a client. I am getting 405 error when I am calling this service using JQuery. Below is the Java code for ws: This is the way i am posting a request to…
Pawan
  • 31,545
  • 102
  • 256
  • 434
4
votes
1 answer

Moxy ignore invalid fields in json

When I send this request: {"invalidField": "value", "date": "value"} to my rest service: @PUT @Consumes("application/json") public void putJson(Test content) { System.out.println(content.toString()); } I expected to get an exception…
4
votes
1 answer

Why is Jersey/JAX-RS client unable to handle generics?

I have a Jersery/JAX-RS client that hits a RESTful API (JSON) that is supposed to return a list of my POJOs: // Hits: GET localhost:8080/myapp/fizz/widget/{widget_id} @Override public List getWidgetsByUser(Long id) { return…
IAmYourFaja
  • 55,468
  • 181
  • 466
  • 756