Reputation: 939
I am using JAX-RS 1.x to develop a simple RESTFul service like /{app_id}/job/list/
So I have defined a resource class like below:
@Path("/{app_id}/job")
@Produces(MediaType.APPLICATION_JSON)
public class JobService {
@GET
@Path("list")
public Response list(@PathParam("app_id") final String appId) {
// ....
}
}
But it seems the implementation (RestEasy in my case) is not able to find this resource. If I make it /job/{app_id}/list
, it works but not /{app_id}/job/list
.
Is it because I have used variable {app_id}
as a beginning path element? Does JAX-RS expects first path element to be fixed?
The root resource is defined as just /
.
Upvotes: 2
Views: 364
Reputation:
Is it because I have used variable {app_id} as a beginning path element? Does JAX-RS expects first path element to be fixed?
No, a template parameter can be anywhere in the path and it can be on the resource (= class) or subresource (= method).
Your code works if there is no other JAX-RS resource. Check your system for other @Path
s that might match your URI path.
Upvotes: 3