Explain about the RESTful Root Resource Classes in the JAX-RS API?

DWQA QuestionsCategory: Web Design HTMLExplain about the RESTful Root Resource Classes in the JAX-RS API?
Editor Staff asked 1 month ago

Explain about the RESTful Root Resource Classes in the JAX-RS API?

1 Answers
Editor Staff answered 1 month ago
  • A resource class is nothing but a Java class that uses JAX-RS provided annotations for implementing web resources.
  • They are the POJOs that are annotated either with @Path or have at least one method annotated with @Path, @GET, @POST, @DELETE, @PUT, etc.

Example:

import javax.ws.rs.Path;
/**
* InterviewBitService is a root resource class that is exposed at 'resource_service' path
*/
@Path('resource_service')
public class InterviewBitService {
   // Defined methods
}