Advertisement
Guest User

Untitled

a guest
Dec 8th, 2016
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. {
  2. "names": [
  3. {
  4. "id":"<number>",
  5. "name":"<string>",
  6. "type":"<string>",
  7. }
  8. ]
  9. }
  10.  
  11. @PUT
  12. @Path("/Id/{Id}/version/{version}/addPerson")
  13. public Response addPerson(@PathParam("Id") String Id,
  14. @PathParam("version") String version) {
  15.  
  16. if (isNull(Id) || isEmpty(version)) {
  17. return ResponseBuilder.badRequest().build();
  18. }
  19.  
  20. //HOW TO RECIEVE MESSAGE BODY?
  21.  
  22. //carry out PUT request and return DTO: code not shown to keep example simple
  23.  
  24.  
  25. if (dto.isSuccess()) {
  26. return Response.ok().build();
  27. } else {
  28. return Response.serverError().build();
  29. }
  30.  
  31. }
  32.  
  33. @PUT
  34. @Consumes("application/json")
  35. @Path("/Id/{Id}/version/{version}/addPerson")
  36. public Response addPerson(@PathParam("Id") String Id,
  37. @PathParam("version") String version,
  38. List<NamObj> names) {
  39.  
  40. @XmlRootElement
  41. public class NameObj {
  42. @XmlElement public int id;
  43. @XmlElement public String name;
  44. @XmlElement public String type;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement