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
588
votes
5 answers

What's the difference between text/xml vs application/xml for webservice response

This is more of a general question about the difference between text/xml and application/xml. I am fairly new to writing webservices (REST - Jersey). I have been producing application/xml since it is what shows up in most tutorials / code examples…
Mike
  • 8,137
  • 6
  • 28
  • 46
227
votes
11 answers

JAX-RS / Jersey how to customize error handling?

I'm learning JAX-RS (aka, JSR-311) using Jersey. I've successfuly created a Root Resource and am playing around with parameters: @Path("/hello") public class HelloWorldResource { @GET @Produces("text/html") public String get( …
Mark Renouf
  • 30,697
  • 19
  • 94
  • 123
198
votes
4 answers

Difference between JAX-RS and Spring Rest

I confused with the difference between JAX-RS (well, maybe should use Jersey to do comparison since JAX-RS is just spec) and Spring for Restful services. I tried to search for more information online and it become more confusing. My company is using…
hades
  • 4,294
  • 9
  • 46
  • 71
136
votes
3 answers

What does Provider in JAX-RS mean?

Could anyone explain to me what a JAX-RS Provider is and what ‘@Provider’ annotation does? I have been reading documentation but I cant get it. If there are resource classes that service the incoming requests, what do Providers do? How are they…
Artem Moskalev
  • 5,748
  • 11
  • 36
  • 55
126
votes
1 answer

How to access parameters in a RESTful POST method

My POST method looks like this: @POST @Consumes({"application/json"}) @Path("create/") public void create(String param1, String param2){ System.out.println("param1 = " + param1); System.out.println("param2 = " + param2); } When I create a…
Klaasvaak
  • 5,634
  • 15
  • 45
  • 68
119
votes
4 answers

what's the correct way to send a file from REST web service to client?

I've just started to develop REST services, but I've come across a difficult situation: sending files from my REST service to my client. So far I've gotten the hang of how to send simple data types (strings, integers, etc) but sending a file is a…
Uriel
  • 1,365
  • 2
  • 12
  • 15
117
votes
6 answers

RESTful on Play! framework

We are planning a project primarily serving content to mobile apps, but need to have a website. My question is whether is makes sense to use Jersey or Restlet to develop REST APIs for our mobile apps, and then use Play! to serve the website. Or…
Gary
  • 1,179
  • 2
  • 8
  • 4
115
votes
10 answers

Input and Output binary streams using JERSEY?

I'm using Jersey to implement a RESTful API that is primarily retrieve and serve JSON encoded data. But I have some situations where I need to accomplish the following: Export downloadable documents, such as PDF, XLS, ZIP, or other binary…
Tauren
  • 26,795
  • 42
  • 131
  • 167
114
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,353
  • 2
  • 10
  • 8
111
votes
4 answers

What is the difference between @PathParam and @QueryParam

I am newbie in RESTful jersey. I would like to ask what is the different between @PathParam and @QueryParam in jersey?
Mellon
  • 37,586
  • 78
  • 186
  • 264
111
votes
6 answers

Jackson + Builder Pattern?

I'd like Jackson to deserialize a class with the following constructor: public Clinic(String name, Address address) Deserializing the first argument is easy. The problem is that Address is defined as: public class Address { private…
Gili
  • 86,244
  • 97
  • 390
  • 689
107
votes
5 answers

What difference between Jersey vs jax-rs

I really cant understand what really is jersey.. What I know is that Jax-RS is an API for building REST web services, and jersey? I got some information and all say the same: "jersey is an implementation of Jax-RS". But what it means? If jax-rs is…
user1851366
  • 256
  • 6
  • 20
  • 41
98
votes
5 answers

Jersey: Print the actual request

How can I view the actual request that Jersey generates and sends to the server? I am having issues with a particular request and the fellow running the webserver asked to see the full request (with headers and the such).
Haphazard
  • 10,900
  • 6
  • 43
  • 55
95
votes
3 answers

How can I grab all query parameters in Jersey JaxRS?

I am building a generic web service and need to grab all the query parameters into one string for later parsing. How can I do this?
Tom
  • 953
  • 1
  • 7
  • 5
94
votes
5 answers

Jersey client: How to add a list as query parameter

I'm creating a Jersey client for a GET service that has a List as query parameter. According to the documentation, it's possible to have a List as a query parameter (this information is also at @QueryParam javadoc), check it out: In general the…
lsborg
  • 1,191
  • 1
  • 12
  • 17
1
2 3
99 100