title: JAX-RS MessageBodyReader
body: <p>I'm learning how the MessageBodyReader method works from the providers. I see the method returns an object and I'm not sure how to access the object from a service. Could I get an explanation on how to get the object returned from the reader class? This would help me apply a reading rule for all DTOs. Thanks in advance!</p>
  <p>Service:</p>
  <pre><code>    @POST
      @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
      @Path(&quot;/CreateAccount&quot;)
      @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
      public Response createAccount(@Context HttpServletRequest req) {
          
          String a = &quot;Reader success? &quot;;//Would to see that string here!
          return Response.ok().build();
      }
  </code></pre>
  <p>Provider:</p>
  <pre><code>@Provider
  public class readerClass implements MessageBodyReader&lt;Object&gt;
  {
  
  @Override
  public boolean isReadable(Class&lt;?&gt; paramClass, Type paramType,
          Annotation[] paramArrayOfAnnotation, MediaType paramMediaType) {
      // TODO Auto-generated method stub
      return true;
  }
  
  @Override
  public Object readFrom(Class&lt;Object&gt; paramClass, Type paramType,
          Annotation[] paramArrayOfAnnotation, MediaType paramMediaType,
          MultivaluedMap&lt;String, String&gt; paramMultivaluedMap,
          InputStream paramInputStream) throws IOException,
          WebApplicationException {
      // TODO Auto-generated method stub
      
      return &quot;Successfully read from a providers reader method&quot;;
  }
  
  }
  </code></pre>