title: Spring MVC Restful service response
body: <p>Any idea why I get a "HTTP/1.1 200 OK" when I set </p>
  
  <pre><code>Response.status(Response.Status.NOT_FOUND)
  </code></pre>
  
  <p>I can see that this has been set correctly in the response body?</p>
  
  <pre><code>curl -v http://my_host/api/v1/user/99999999
  </code></pre>
  
  <p><strong><em>HTTP/1.1 200 OK</em></strong></p>
  
  <p>Access-Control-Allow-Origin: *</p>
  
  <p>Access-Control-Allow-Methods: POST, GET, OPTIONS, DELETE</p>
  
  <p>....</p>
  
  <p>{"statusType":"NOT_FOUND","entity":"Unable to retrieve product with id:99999999","entityType":"java.lang.String","status":404,"metadata":{}}</p>
  
  <pre><code>@RequestMapping(value="/product/{id}", method=RequestMethod.GET)
  @ResponseBody
  public Response getProduct(@PathVariable String id) {
  
      Product product = null; //productService.getProduct(id);
      if (product == null) {
          // I KNOW I GET HERE !!!
          return Response.status(Response.Status.NOT_FOUND).entity("Unable to retrieve product with id:"+id). build();
      }
  
      // AS EXPECTED I DO NOT GET HERE
      Map&lt;String, Object&gt; json = productRenderer.renderProduct(....);
      return Response.ok(json, MediaType.APPLICATION_JSON).type("application/json").build();
  }
  </code></pre>
  
  <p>BTW am using Spring version 3.2.10</p>