Skip to content

Instantly share code, notes, and snippets.

@cvasilak
Created February 19, 2013 12:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cvasilak/4985258 to your computer and use it in GitHub Desktop.
Save cvasilak/4985258 to your computer and use it in GitHub Desktop.
package com.mkyong.rest;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.FormParam;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.core.Response;
//http://localhost:8080/RESTfulExample/rest/message/hello%20world
@Path("/message")
public class MessageRestService {
@GET
public Response printMessage() {
try {
Thread.sleep(10000);
} catch (Exception e) {
}
String result = "Restful example";
return Response.status(200).entity(result).build();
}
@POST
@Path("/add")
public Response dummyPost(@FormParam("name") String name) {
try {
Thread.sleep(10000);
} catch (Exception e) {
}
return Response.status(200)
.entity("addUser is called, name : " + name)
.build();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment