RESTful Web Services Developer's Guide

Annotating the Resource Class

The following code is the contents of the com.sun.jersey.samples.helloworld.resources.HelloWorldResource class:

import javax.ws.rs.GET;
import javax.ws.rs.Produces;
import javax.ws.rs.Path;

@Path("/helloworld")
public class HelloWorldResource {

		@GET
		@Produces("text/plain")
		public String getClichedMessage() {
			return "Hello World";
	}
}

In this example, the following annotations are processed at runtime: