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
1 answer

Is it possible to catch SAXParseException in JAX-RS/JAXB webservice?

I would like to check in a JAX-RS webservice request that valid XML was included in the body. However, this code: @PUT @Produces(MediaType.TEXT_XML) @Consumes(MediaType.TEXT_XML) @Path("/{objectID}") public MyObject…
sdoca
  • 7,832
  • 23
  • 70
  • 127
3
votes
1 answer

java.lang.ClassNotFoundException: javax.enterprise.event.Event

I have a problem with deploy Java EE application to WildFly I tried different ways. I created java app by maven archetype (wildfly-javaee7-webapp-ear-archetype) And tried run to Wildfy via Idea (and admin console), but got error deploy: Cannot…
Serj Malko
  • 326
  • 4
  • 15
3
votes
3 answers

Ordering of REST end points in JAX RS

I have two REST end points, one to delete some data to all employees,and another to delete data for a specific employee by employee ID. These are the two methods : @Path("/{empId}/data") @DELETE public Response deleteEmpDataa(@PathParam("empId")…
Vinoth Kumar C M
  • 10,378
  • 28
  • 89
  • 130
3
votes
1 answer

ExceptionMapper not working as expected

I am using jersey for REST web services. I am handling all 404 responses by throwing NotFoundException(Package com.sun.jersey.api) whenever I don't get any object from service layer. e.g.…
dk_123
  • 41
  • 1
  • 2
3
votes
2 answers

Swagger documentation with JAX-RS Jersey 2 and Grizzly

I have implementated a Rest web service (the function is not relevant) using JAX-RS. Now I want to generate its documentation using Swagger. I have followed these steps: 1) In build.gradle I get all the dependencies I need: compile…
Santiago Gil
  • 1,292
  • 7
  • 21
  • 52
3
votes
2 answers

Mocking EJB's with Mockito and Jersey Test Framework

I was able to use the jersey test framework to test my JAX-RS restful api. However, I cannot get my EJB's to properly be mocked no matter what I try. Using the example provided by @peeskillet, the point at which my EJB is referenced in the Resource…
Jenn Sears
  • 43
  • 1
  • 8
3
votes
1 answer

Implementing generic JAX-RS web service using javax.ws.rs.core.Application

Servlet 3.0-enabled containers allows us to skip the web.xml servlet configuration and automatically scan your code for resources and providers once you extend javax.ws.rs.core.Application, annotate it with @ApplicationPath and do not override the…
gb.
  • 168
  • 3
  • 11
3
votes
1 answer

Identify HTTP Verb on JAX-RS via Reflection

I am writing some code to figure out metadata about classes implemented with JAX-RS and I'm writing a method that takes a Method and returns the HTTP Verb related to that method, basically figure out if it's annotated with @POST, @GET, @PUT or…
Rodrigo Sasaki
  • 7,048
  • 4
  • 34
  • 49
3
votes
1 answer

Writing into ServletContext in Jersey using annotation.

I have a class like this: public class MyResource(){ public MyResource(@Context ServletContext context){ context.setAttribute("someAttribute","someVal"); } @PUT public void someMethod(){ ... …
LAC
  • 852
  • 4
  • 11
  • 31
3
votes
1 answer

JAX-RS web service is working on GlassFish Server 4.0 but not working on Tomcat

I am new to web services. So I started with a small program like the following. It's working perfectly in GlassFish server but not in Tomcat (I want to run on Tomcat). It's a simple program which gives only the idea of how to run the web service…
sandy
  • 93
  • 2
  • 9
3
votes
4 answers

How can I serve static content from CXF / JAX-RS with my rest API mapped to root context?

I have a rest API using CXF to implement JAX-RS where the REST endpoints are directly on the root context. For example if my root context is localhost:8080/myservice And my endpoints…
Nathan Hadzariga
  • 342
  • 3
  • 16
3
votes
1 answer

Servlet 3.0 and JAX-RS

I've found conflicting answers to this question and I've failed to successfully run an example. Can JAX-RS be implemented using Servlet 3.0 (in particular, Tomcat 7) with annotations, only, without having to implement another Servlet Container?…
Lee Duckworth
  • 240
  • 4
  • 15
3
votes
2 answers

Combining @Context and @RolesAllowed in a JAX-RS resource?

Is it possible to use Context annotation and RolesAllowed annotation in a JAX-RS resource with Apache CXF 2.4.6 and Spring Security 3.2.8? My CXF configuration:
dur
  • 15,689
  • 25
  • 79
  • 125
3
votes
1 answer

How to make a gzipped response in a Neo4j unmanaged extension?

Hi, I am trying to make a gzipped response in a Neo4j unmanaged extension. I found this example: http://www.codingpedia.org/ama/how-to-compress-responses-in-java-rest-api-with-gzip-and-jersey/ I tried to add this…
David Berg
  • 1,958
  • 1
  • 21
  • 37
3
votes
1 answer

How to call swagger codegen programmatically?

I am generating a restful java jax-rs api with swagger-codgen-cli.jar. Right now I call java -jar with some command line options to do this. java -jar swagger-codegen-cli.jar generate -i api.yaml -l jaxrs -o ./outputdir Which works fine. But I…
MidgarZolom
  • 195
  • 5
  • 15
1 2 3
99
100