title: What strategy to use to determine JSON or XML?
body: <p>When using Spring, what is considered best practice when both JSON and XML is to be returned?</p>
  
  <p>Say I have a method:</p>
  
  <pre><code>@RequestMapping(value="items/{id}", method = RequestMethod.GET)
  public Item getItem(@PathVariable, Long id) {
     // Find and return item.
  }
  </code></pre>
  
  <p>How can I invoke this in a style like:
  <code>localhost:8080/app-name/items/1.xml</code> and <code>localhost:8080/app-name/items/1.json</code> and get the data in their respective formats?</p>