title: How can a resource method produce or consume two different MIME types?
body: <p>How can this resource method produce <code>json</code> or <code>xml</code> results ?</p>
  
  <p>Should I parse the request accept header and make an <code>if/else</code> branch, or <a href="/questions/tagged/jersey" class="post-tag" title="show questions tagged &#39;jersey&#39;" rel="tag">jersey</a> will do that 
  for me  ? </p>
  
  <pre><code>@GET
  @Produces({"application/xml", "application/json"})
  public String doGetAsXmlOrJson() {
      ...
  }
  </code></pre>
  
  <p>An example of how <code>doGetAsXmlOrJson()</code> may implemented will nice.</p>