I have written a resource class with which I want to support multiple resource paths.
@Path("/path/to/jobs")
public class JobController {
@GET
@Produces(MediaType.APPLICATION_JSON)
public List<JobDto> getJobs() {
...
}
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("{job_id}")
public JobDto getJob() {
...
}
}
The problem is that this accepts the path localhost:80/path/to/jobs
but not localhost:80/path/to/jobs/job123
. I have tried annotating the class with /path/to
and the methods with jobs
and jobs/{job_id}
. It still doesn't work. Any pointers?
I found this question and this which seem to suggest I should be able to do this.