title: MessageBodyReaderSupport for DTO Classes?
body: <p>I want to use the <a href="https://github.com/krasserm/grails-jaxrs" rel="nofollow">Grails-jaxrs plugin</a> to implement a custom <a href="https://github.com/krasserm/grails-jaxrs/blob/master/src/java/org/grails/jaxrs/support/MessageBodyReaderSupport.java" rel="nofollow">MessageBodyReaderSupport</a> to read a UserDto class from a client. </p>
  
  <p><strong>How do I have to implement the UserDtoReader in order to get an instance of the UserDto?</strong></p>
  
  <p>This is my UserDto class:  </p>
  
  <pre><code>public class UserDto {
      private String firstName;
      private String lastName;
  
      public UserDto() {
          firstName = "";
          lastName = "";
      }
  
      public UserDto(String firstName,
                     String lastName) {
  
          this.firstName = firstName;
          this.lastName = lastName;
      }
  
      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;
      }
  
  
      @Override
      public String toString() {
          String s = " { User ";
          s += "id=" + id + " ";
          s += "firstName=" + firstName + " ";
          s += "lastName=" + lastName + " ";
          s += " User } ";
          return s;
      }
  }
  </code></pre>
  
  <p>This is my UserDtoReader class:</p>
  
  <pre><code>@Consumes("application/json")
  class UserDtoReader extends MessageBodyReaderSupport&lt;UserDto&gt; {
  
      @Override
      public UserDto readFrom(MultivaluedMap&lt;String, String&gt; httpHeaders,
              InputStream entityStream) throws IOException,
              WebApplicationException {
          // TODO Auto-generated method stub
          return null;
      }
  }
  </code></pre>