title: How to print the attributes from request in response in java using RestFull webservice?
body: <p>I have been following a tutorial of RestFull webservices, but i am not able to understand some concepts.
  Here is my PersonServiceImpl class.</p>
  
  <pre><code>    @Path("/person")
      @Consumes(MediaType.APPLICATION_JSON)
      @Produces(MediaType.APPLICATION_JSON)
      public class PersonServiceImpl implements PersonService{
  
      private static Map&lt;Integer,Person&gt; person = new HashMap&lt;Integer,Person&gt;();
  
  
      @Override
      @Path("/add")
      @POST
      public Response addPerson(Person p) {
          Response response = new Response();
  
          if(person.get(p.getId())!=null) {
              response.setStatus(false);
              response.setMessage("Person already exists");
          }
              person.put(p.getId(),p);
              response.setStatus(true);
              response.setMessage("Person added sucessfully ");
              return response;
      }
  
      @Override
      public Response deletePerson(int id) {
          // TODO Auto-generated method stub
          return null;
      }
  
      @Override
      public Person getPerson(int id) {
          // TODO Auto-generated method stub
          return null;
      }
  
      @Override
      public Person[] getAllPerson() {
          // TODO Auto-generated method stub
          return null;
      }
     }
  </code></pre>
  
  <p>I have made some changes in the code to produce and consume json file.
  This is my person class</p>
  
  <pre><code>@XmlRootElement(name = "person")
  public class Person {
      private String name;
      private int age;
      private int id;
  
  
      public String getName() {
          return name;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  
      public int getAge() {
          return age;
      }
  
      public void setAge(int age) {
          this.age = age;
      }
  
      public int getId() {
          return id;
      }
  
      public void setId(int id) {
          this.id = id;
      }
  
  
  }
  </code></pre>
  
  <p>And this is my Response class</p>
  
  <pre><code>@XmlRootElement
  public class Response {
  
      private boolean status;
      private String message;
      public boolean isStatus() {
          return status;
      }
  
      public void setStatus(boolean status) {
          this.status = status;
      }
  
      public String getMessage() {
          return "" + message;
      }
  
      public void setMessage(String message) {
          this.message= message;
      }
  
  
  }
  </code></pre>
  
  <p>And here is my pom.xml</p>
  
  <pre><code>    &lt;project xmlns="http://maven.apache.org/POM/4.0.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;JAXRS-EXAMPLE&lt;/groupId&gt;
      &lt;artifactId&gt;JAXRS-EXAMPLE&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;packaging&gt;war&lt;/packaging&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.sun.jersey&lt;/groupId&gt;
              &lt;artifactId&gt;jersey-server&lt;/artifactId&gt;
              &lt;version&gt;1.19&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.sun.jersey&lt;/groupId&gt;
              &lt;artifactId&gt;jersey-json&lt;/artifactId&gt;
              &lt;version&gt;1.18.1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.owlike&lt;/groupId&gt;
              &lt;artifactId&gt;genson&lt;/artifactId&gt;
              &lt;version&gt;0.99&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.sun.jersey&lt;/groupId&gt;
              &lt;artifactId&gt;jersey-servlet&lt;/artifactId&gt;
              &lt;version&gt;1.19&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.sun.jersey&lt;/groupId&gt;
              &lt;artifactId&gt;jersey-client&lt;/artifactId&gt;
              &lt;version&gt;1.19&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
      &lt;build&gt;
          &lt;sourceDirectory&gt;src&lt;/sourceDirectory&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.0.0&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;warSourceDirectory&gt;WebContent&lt;/warSourceDirectory&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.3&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;1.8&lt;/source&gt;
                      &lt;target&gt;1.8&lt;/target&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>I want to know :</p>
  
  <ol>
  <li>How to print the values of person class in the response?</li>
  <li>How the json values are mapped to the java attributes and where?
  3.If i enter a extra value in the json request what happens to that value?</li>
  </ol>
  
  <p>The link to the tutorial: <a href="https://www.journaldev.com/9170/restful-web-services-tutorial-java" rel="nofollow noreferrer">https://www.journaldev.com/9170/restful-web-services-tutorial-java</a></p>