In the lab @ http://javajee.com/setting-up-the-environment-for-developing-rest-web-services-with-jersey-using-maven, you setup the environment and executed a REST service.
Below are the important files generated, as you can see from the eclipse Project Explorer:
By clicking on the link ‘Jersey Resource’, you actually made an http request to the rest resource path “webapi/myresource”.
You can verify the path by going to the index.jsp file available under Deployed Resources.
The actual resource file (MyResource.java) is available under Java resources.
@Path specifies the path to this resource.
@GET specifies the method that needs to be executed if a GET request comes to the above path.
@Produces(MediaType.TEXT_PLAIN) specifies that the response will be sent as plain text.
Requests are actually handled by the servlet org.glassfish.jersey.servlet.ServletContainer, which is mapped to the url pattern /webapi/* in the web.xml file.
Actual resource path is appended to this url pattern to form the final resource url: webapi/myresource.
The init param jersey.config.server.provider.packages contains the packages under which jersey will look for REST resources.