Reputation: 1400
What is Resteasy? what is the difference between RESTEasy and JAX-RS?
What is the difference between @PathParam
and @QueryParam
?
Upvotes: 13
Views: 16497
Reputation: 111
Please also note that JAX-RS is only server side specification and RESTEasy has extended it to bring JAX-RS to the client side through the RESTEasy JAX-RS Client Framework.
Info on param, What is the difference between @PathParam and @QueryParam Some great points here regarding params, When to use @QueryParam vs @PathParam - Gareth's answer
Upvotes: 1
Reputation: 2404
Query parameters are extracted from the request URI query parameters, and are specified by using the javax.ws.rs.QueryParam annotation in the method parameter arguments.
Example:
@Path("smooth")
@GET
public Response smooth(
@DefaultValue("2") @QueryParam("step") int step,
@QueryParam("minm") boolean hasMin,
@QueryParam("test") String test
) { ... }
URL: http://domain:port/context/XXX/smooth?step=1&minm=true&test=value
URI path parameters are extracted from the request URI, and the parameter names correspond to the URI path template variable names specified in the @Path class-level annotation. URI parameters are specified using the javax.ws.rs.PathParam annotation in the method parameter arguments
Example:
@Path("/{userName}")
public class MyResourceBean {
...
@GET
public String printUserName(@PathParam("userName") String userId) {
...
}
}
URL: http://domain:port/context/XXX/naveen
Here, naveen takes as the userName(Path parameter)
Upvotes: 7
Reputation: 105043
JAX-RS is a set of interfaces and classes without real implementation that belong to javax.ws.rs.*
packages (they are part of Java SE 6, by Oracle).
RESTEasy as well as, for example, Jersey or Apache CXF, are open source implementations of that JAX-RS classes.
During compilation you need only JAX-RS. In runtime you need only one of that implementations.
Upvotes: 8
Reputation: 308001
According to its homepage RESTEasy is
... a fully certified and portable implementation of the JAX-RS specification.
So JAX-RS is a specification of how a library for implementing REST APIs in Java should look like and RESTEasy is one implementation of that specification.
This effectively means that any documentation on JAX-RS should apply 1:1 to RESTEasy as well.
Upvotes: 22