title: Add Delete Method in a RESTful web service
body: <p>I am making my first RESTful web service (using MySQL). But I don't know how to remove records from a table by id. </p>
  
  <p>This is what I have done so far:</p>
  
  <ol>
  <li><p>Search for a person by id and return the result(id, full name and age) in XML format: </p>
  
  <pre><code>private PersonDao personDao = new PersonDao();
  //method which return a single person in xml
  @GET
  @Path("/getPersonByIdXML/{id}")
  @Produces(MediaType.APPLICATION_XML)
  public Person getPersonByIdXML(@PathParam("id")int id){
      return personDao.getPersonById(id);
  }
  
  // return JSON response
  </code></pre></li>
  <li><p>Search for a person by id and return the result(id, full name and age) in JSON format: </p>
  
  <pre><code>@GET
  @Path("/getPersonByIdJSON/{id}")
  @Produces(MediaType.APPLICATION_JSON)
  public Person getPersonById(@PathParam("id")int id){
      return personDao.getPersonById(id);
  }
  </code></pre></li>
  <li><p>Output all persons and return the result(id, full name and age) in JSON format: </p>
  
  <pre><code>// the method returns list of all persons
  @GET
  @Path("/getAllPersonsInXML")
  @Produces(MediaType.APPLICATION_XML)
  public List&lt;Person&gt; getAllPersonsInXML(){
      return personDao.getAllPersons();
  }
  </code></pre></li>
  <li><p>Insert a person in the database:</p>
  
  <pre><code>//insert
  @GET
  @Path("/insertPerson/{fullName}/{age}")
  @Produces(MediaType.APPLICATION_JSON)
  public String saveNewPerson(@PathParam("fullName") String fullName, @PathParam("age") int age) {
      Person person = new Person();
  
      person.setFullName(fullName);
      person.setAge(age);
  
      if (!personDao.savePerson(person)) {
          return "{\"status\":\"ok\"}  id="+person.getId();
      }
      else {
          return "{\"status\":\"not ok\"}";
      }
  }
  </code></pre></li>
  <li><p>Edit a person in the database:</p>
  
  <pre><code>//update
  @GET
  @Path("/insertPerson/{id}/{fullName}/{age}")
  @Produces(MediaType.APPLICATION_JSON)
  public String updatePerson(@PathParam("id") int id, @PathParam("fullName") String fullName, @PathParam("age") int age) {
      Person person = new Person();
      person.setId(id);
      person.setFullName(fullName);
      person.setAge(age);
  
      if (!personDao.savePerson(person)) {
          return "{\"status\":\"ok\"}";
      }
      else {
          return "{\"status\":\"not ok\"}";
      }    
  }
  </code></pre></li>
  </ol>