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
3
votes
0 answers

What is the best way to define URLs / routes in Dropwizard?

Coming from frameworks like Django, I've found Dropwizard's URL handling involves lots of hardcoded routes: @Path("/home") @Produces(MediaType.TEXT_HTML) public class HomeResource { ... } ... return…
fredley
  • 32,953
  • 42
  • 145
  • 236
3
votes
1 answer

Advice on http-method overloading in REST

I've used a regular expression in @Path to achieve overloading and at first I thought it was really neat, but overloading methods is usually not good practice. Does the same apply to RESTful web services? Is there a better way to achieve this using…
willcodejavaforfood
  • 43,223
  • 17
  • 81
  • 111
3
votes
2 answers

Restful service with CXF and Kerberos authentication

Having a hard time trying to protect an existing CXF JAX-RS service with Kerberos authentication. I went through what seems to be the reference documentation : http://cxf.apache.org/docs/jaxrs-kerberos.html but it did not help much. I'm actually…
Ramzi Oueslati
  • 351
  • 1
  • 6
3
votes
2 answers

How to enable Bean Validation with Jax RS in TomEE 7.0.0-M1?

I'm aware I must be missing some really basic point. The following resource method: @GET @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public TestObject getObj(@QueryParam("m") String m, @Min(30)…
kosta
  • 296
  • 2
  • 6
  • 15
3
votes
1 answer

What's the different between Jersey @Consumes and @Produces

What's the different between Jersey @Consumes and @Produces? I'm confused within Jersey Restful service.
Neil
  • 2,714
  • 11
  • 29
  • 45
3
votes
1 answer

Enunciate not working with Generics

My resource is @GET @Path("/items") public MyCollection getItems()throws Exception{ //Code to return MyCollection } My Item class is @XmlRootElement public class Item{ private int id; private String name; …
Jeevi
  • 2,962
  • 6
  • 39
  • 60
3
votes
1 answer

How to get the JSESSIONID from a HTTP request using ContainerRequestContext?

I have the following HTTP headers in a request and I want to extract the JSESSIONID from…
Imran khan
  • 819
  • 3
  • 12
  • 24
3
votes
3 answers

JAX-RS: NoSuchMethodFound Exception Jersey-media-moxy JSON

I have been struggling with this for hours now. I'm working on JAX-RS with jersey. Everything was going fine until I had to return JSON at one place. I know there must be a jersey-media-moxy library to be there in order to binding your Java objects…
Syed Danish Ali
  • 381
  • 1
  • 6
  • 22
3
votes
1 answer

How do I set the xml namespace when using Jersey, jaxb & jax-rs

How do I set the xml namespace when using Jersey, jaxb & jax-rs
John
  • 1,852
  • 4
  • 26
  • 49
3
votes
2 answers

Error when made AngularJS $http request POST

I want to access POST method from my server, but when I logged the response, it's always return status=0, anyone can help me or give me an advise? note: I've tried my method in Postman and it's works anyway This is my…
3
votes
1 answer

JAX RS WebApplicationException do not log

I inject a bean into my REST web service and then call a method from my bean where the following exception gets thrown: throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND)).build()); The hole stack trace gets printed. How…
perotom
  • 851
  • 13
  • 33
3
votes
2 answers

using servlets name and servlets-url in web.xml in java eclipse

i want to know what should i put inside Servletname tag and url path in servlet-mapping in web.xml in eclipse.i tried googling it but i didnt find answer. Please suggest me in this, i am creating rest services in Java. …
allDroid
  • 405
  • 1
  • 10
  • 21
3
votes
2 answers

How can I get root-context url with JAX-RS?

With given Application @ApplicationPath("/api") public class MyApplication { } UriInfo#getBaseUri gives me an application path. @Context private UriInfo uriInfo uriInfo.getBaseUri(); // http://address//api How can I get…
Jin Kwon
  • 20,295
  • 14
  • 115
  • 184
3
votes
2 answers

In Java EE 6, how do I get the URL of a JAX-RS endpoint programmatically?

TomEE 1.7.2, Java EE 6, Java 8 I have this JAX-RS Application: @ApplicationPath("/api") public class CallStatsCatcherApplication extends Application { @Override public Set> getClasses() { return new…
Jonathan S. Fisher
  • 8,189
  • 6
  • 46
  • 84
3
votes
2 answers

JAX-RS/Jersey path parameter regex for a simple string

I am trying to match strings v1 and v2. For that, I am trying the following regex : ^v(1|2) (I also tried with $ which is probably what I need). When I test it in http://www.regextester.com/, it seems to work fine. But when I used it in JAX-RS path…
500865
  • 6,920
  • 7
  • 44
  • 87