title: In JAX RS, differences between returning Response and Bean or Collection of Beans (DTO)
body: <p>I am working on building a REST api. My question is, when using Jersey, what are the differences between my services building and returning a Response object or returning the the bean or collection. I am only concerned with successful calls, I am throwing appropriate exceptions for errors and exceptional situations.</p>
  
  <p>Here is a example:</p>
  
  <pre><code>@Produces(MediaType.APPLICATION_JSON)
  public Response search(FooBean foo){
      List&lt;FooBean&gt; results = bar.search(foo);
      return Response.ok(results).build();
  }
  </code></pre>
  
  <p>vs.</p>
  
  <pre><code>@Produces(MediaType.APPLICATION_JSON)
  public List&lt;FooBean&gt; search(FooBean foo){
      List&lt;FooBean&gt; results = bar.search(foo);
      return results;
  }
  </code></pre>
  
  <p>I've seen both examples used, and I'd prefer the second scenario, just to make it easier to recognize the service method. I've examined the responses to both of these methods and they appear to be identical. </p>
  
  <p>Thoughts?</p>