Skip to content

Instantly share code, notes, and snippets.

@chanakaDe
Created November 11, 2015 15:43
Show Gist options
  • Save chanakaDe/0255f88a645fca5b711c to your computer and use it in GitHub Desktop.
Save chanakaDe/0255f88a645fca5b711c to your computer and use it in GitHub Desktop.
package com.chanakaSample;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
/**
* Root resource (exposed at "myresource" path)
*/
@Path("myresource")
public class MyResource {
/**
* Method handling HTTP GET requests. The returned object will be sent
* to the client as "text/plain" media type.
*
* @return String that will be returned as a text/plain response.
*/
@GET
@Produces(MediaType.TEXT_PLAIN)
public String getIt() {
return "Got it!";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment