title: REST GET api - what to return when resource not found
body: <p>I am using jersey to create rest api. I have GET api which returns xml or json representation of an object instance using JaXB. <br/>Everything is fine as long as I can get this instance based on id and return it. But when I don't find instance what should I return. I know 404 response has to be returned. But my method already returns a given type. So how do I setup 404 status is response?</p>
  
  <p>Here is simplified version of my method<br/></p>
  
  <pre><code>@GET
  @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
  public GameDAO getGameState(@PathParam("gameId") String gameId)
  {
   //code to get game instance based on gameId
      if(game != null)
      {
          GameDAO d = new GameDAO(game);
          return d; //gets auto converted to xml or json
      }
  
      return null; //how to return not found response ?
  }
  </code></pre>