Next, we shall create a RESTful web service resource using a root resource class. A root resource class
is a POJO, annotated with the @PATH
annotation and consisting of at least one method annotated with the @PATH
annotation or request method designator such as @GET
, @PUT
, @POST
, or @DELETE
. We shall create a root resource
class with some resource methods using the @GET
request method designator. Select File | New | Other and in the New wizard select Java | Class. Click on Finish. In New Java Class specify Source folder (EclipseJAX-RS/src
), specify Package (jaxrs
), and specify a class name (HelloWorldResource
) in the Name field. Click on Finish, as shown in the following screenshot:
Annotate the Java class with the @PATH
annotation. Specify the URI path on which the Java class shall be hosted as /helloworld
:
@Path("/helloworld") public class HelloWorldResource { … }
We shall add
resource methods to produce three different MIME types. Add the getClichedMessage...