Advertisement
Avatarr

rest

Jun 12th, 2013
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.73 KB | None | 0 0
  1. @Path("json/service")
  2. public class SeviceResource implements ItemResourceInterface {
  3.  
  4.     //resources/json/service
  5.     @GET
  6.     @Path("/api")
  7.     @Produces("application/json")
  8.     @Override
  9.     public Response getJson() {
  10.        List<ItemCreate> items = new ArrayList<ItemCreate>();
  11.       items.add(new ItemCreate("8", "3", "5", "base64 code","base64 code");
  12.  
  13.    return Response.status(200).entity(items).build();
  14.  
  15.     }
  16.  
  17.     @POST
  18.     @Path("/api")
  19.     @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
  20.     @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
  21.     @Override
  22.     public Response createJson(String data) {
  23.  
  24.      return Response.status(200).entity(data).build();
  25.  
  26.  
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement