Share

Search Java Code Snippets


  Help us in improving the repository. Add new snippets through 'Submit Code Snippet ' link.





Java - Code Samples

 Sample 1. Rest Web Service ( Get ) using Jersey

@Path("/employeeInfo")
public class RestWebServiceJersey {
@GET
@Path("/detail/{employeeId}")
@Produces(MediaType.APPLICATION_JSON)
public String getEmployeeInfo(@PathParam("employeeId") String employeeId) {
JSONObject jsonObj = new JSONObject();
jsonObj.put("EmployeeName", "Sam");
jsonObj.put("EmployeeDept", "Marketing");
return jsonObj.toString();
}
}

   Like      Feedback     rest  rest web service  jersey  @path  @get  @produces  MediaType.APPLICATION_JSON  @PathParam  JSONObject  javax.json.JSONObject



Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner



comments powered by Disqus