title: Data format to test Spring Rest Services
body: <p>I am testing spring rest services, particularly POST method. <br>
  Here is the code snippet of my controller:  </p>
  
  <pre><code>@RequestMapping(value = "/testrequest", method = RequestMethod.POST, headers = "Accept=application/json")
      public @ResponseBody String createEmployee(@RequestBody Employee e){
          String value = "id " + e.getId() + "firstName " + e.getFirstName() + "lastname " + e.getLastName();
          System.out.println(value);
          return value;
      }
  </code></pre>
  
  <p><br></p>
  
  <p>Employee class: </p>
  
  <pre><code>public class Employee {
  
      private int id;
      private String firstName;
      private String lastName;
  
      public Employee(int id,String firstName,String lastName){
          this.id = id;
          this.firstName = firstName;
          this.lastName = lastName;
      }
  
      public Employee() {
          // TODO Auto-generated constructor stub
      }
  
      public int getId() {
          return id;
      }
      public void setId(int id) {
          this.id = id;
      }
      public String getFirstName() {
          return firstName;
      }
      public void setFirstName(String firstName) {
          this.firstName = firstName;
      }
      public String getLastName() {
          return lastName;
      }
      public void setLastName(String lastName) {
          this.lastName = lastName;
      }
  }
  </code></pre>
  
  <p>I have included dependency of jackson library in pom.xml as well <br>
   pom.xml</p>
  
  <pre><code>        &lt;dependency&gt;
              &lt;groupId&gt;org.codehaus.jackson&lt;/groupId&gt;
              &lt;artifactId&gt;jackson-mapper-asl&lt;/artifactId&gt;
              &lt;version&gt;1.9.13&lt;/version&gt;
          &lt;/dependency&gt;
  </code></pre>
  
  <p>I am testing the services using firefox poster plugin.
  <img src="https://i.stack.imgur.com/gMsIb.png" alt="enter image description here"></p>
  
  <p>When I submit my request, I am getting Status: <strong>415 Unsupported media type.</strong> <br>
  This is the error message I am getting:
  <em>The server refused this request because the request entity is in a format not supported by the requested resource for the requested method.</em></p>
  
  <p>Please suggest what I am doing wrong?</p>