Questions tagged [jax-rs]

JAX-RS: Java API for RESTful Web Services. It is an API that provides support in creating web services according to the REST architectural style.

JAX-RS: API for RESTful Web Services is an API that provides support in creating web services according to the architectural style. JAX-RS uses annotations, introduced in Java SE 5, to simplify the development and deployment of web service clients and endpoints. From version 1.1 on, JAX-RS is an official part of Java EE.

The home for the JAX-RS JSRs is on Java.net.

JAX-RS is implemented by the following frameworks:

Resources:

7676 questions
35
votes
4 answers

How to deploy a JAX-RS application?

The JAX-RS 1.1 specification says on page 6: If no Application subclass is present the added servlet MUST be named: javax.ws.rs.core.Application What is the added servlet? Could it be an arbitrary servlet? If an Application subclass is…
deamon
  • 89,107
  • 111
  • 320
  • 448
35
votes
3 answers

Can't find javax.ws.rs package in jdk

I'm trying to get into JAX-RS. My project jdk is set to 1.7.03. Does there have to be definitions of annotations for JAX-RS(javax.ws.rs)? If not, where I can find them?
narek.gevorgyan
  • 4,165
  • 5
  • 32
  • 52
34
votes
9 answers

java.lang.AbstractMethodError: javax.ws.rs.core.UriBuilder.uri

I try to start application but using Tomcat 7 and I've got an exception like this. I think this can be something with Maven dependency, but I'm sure. If some know what is going on please for answer:) Exception: message Servlet execution threw an…
user3570228
  • 353
  • 1
  • 3
  • 5
34
votes
6 answers

Setting request timeout for JAX-RS 2.0 Client API

I have written simple REST web service client class which uses the JAX-RS 2.0 client API to make REST requests. I am trying to figure out how to set a request timeout for each invocation. Here is the code for a request: Client client =…
sarabdeep singh
  • 878
  • 1
  • 11
  • 16
33
votes
2 answers

When to use pathParams or QueryParams

Is there a rule of thumb as to when one should use path parameters for a URL versus when you should use query parameters? Say I've got a table Invoice with the fields company(PK),InvoiceNo(PK), Invoiceline, invoiceValue, noOfLines, salesPerson My…
Tim Sparg
  • 3,294
  • 2
  • 27
  • 40
33
votes
3 answers

What is the proper replacement of the Resteasy 3.X PreProcessInterceptor?

I'm building rest service using an authentication/authorization mechanism as described in this tutorial: http://howtodoinjava.com/2013/06/26/jax-rs-resteasy-basic-authentication-and-authorization-tutorial/ Basically it uses the PreProcessInterceptor…
Gilberto Torrezan
  • 5,113
  • 4
  • 31
  • 50
32
votes
3 answers

Jersey Grizzly REST service not visible outside localhost

I'm trying to write a REST service in java using Jersey and Glassfish Grizzly. I have a very simple case working internally, but can't seem to call on the server from an external address. I've tried using a variety of different pairs of machines…
user1596250
  • 329
  • 3
  • 5
31
votes
2 answers

Get HttpServletRequest in Jax Rs / Appfuse application?

I created a basic application shell with AppFuse, and followed the AppFuse tutorial to create a a simple RESTful service with Jax-RS. That works just fine. A call to http://localhost:8080/services/api/persons returns a collection of Person objects…
prototype
  • 7,249
  • 15
  • 60
  • 94
31
votes
5 answers

Using @Context, @Provider and ContextResolver in JAX-RS

I'm just getting acquainted with implementing REST web services in Java using JAX-RS and I ran into the following problem. One of my resource classes requires access to a storage backend, which is abstracted away behind a StorageEngine interface. I…
Tamás
  • 47,239
  • 12
  • 105
  • 124
31
votes
1 answer

WebApplicationException vs Response

Among all the possibilities to return a response to the client in a REST service, I've seen two possibilities that look equivalent: throwing a WebApplicationException (possibly using a Response instance) or returning a Response instance. Why to use…
manash
  • 6,985
  • 12
  • 65
  • 125
30
votes
5 answers

Using Gson instead of Jackson in Jersey

I have a RESTful service that consumes and produces JSON objects, and I would like Jersey to use Gson instead of Jackson. How can this be done...?
Moshe Bixenshpaner
  • 1,840
  • 1
  • 17
  • 23
30
votes
1 answer

How to set and check cookies wih JAX-RS?

I am a noobie with RESTful API and I am trying to build a Login service in which I provide an email and password and if the validation is successful - to store a cookie. In addition, how do I check the cookie(if stored)? How can this be…
Gil404
  • 711
  • 1
  • 8
  • 22
30
votes
6 answers

FileUpload with JAX-RS

I try to do file upload from a JavaScript client to a JAX-RS Java server. I use the following REST upload function on my server: @POST @Produces('application/json') UploadDto upload( @Context HttpServletRequest request, …
Michael
  • 32,527
  • 49
  • 210
  • 370
30
votes
9 answers

Sort API methods in Swagger-UI

I cannot find any working example, how to achieve the following: I want my API methods in the Swagger-UI sorted either by methods (GET-POST-PUT-DELETE) OR/AND alphabetically. So far, all methods are displayed in a random order, even not in the order…
ulrich
  • 1,431
  • 3
  • 17
  • 46
30
votes
5 answers

Jersey 2 injection source for multipart formdata

I had a method: @POST @Consumes("multipart/form-data") @Produces( {"text/xml"}) public Response processForm( @FormDataParam("myparam") InputStream is, @FormDataParam("myparam") FormDataContentDisposition detail) which worked fine with…
JasonPlutext
  • 15,352
  • 4
  • 44
  • 84