title: How to return 404 response status in Spring Boot @ResponseBody - method return type is Response?
body: <p>I'm using Spring Boot with @ResponseBody based approach like the following:</p>
  
  <pre><code>@RequestMapping(value = VIDEO_DATA_PATH, method = RequestMethod.GET)
  public @ResponseBody Response getData(@PathVariable(ID_PARAMETER) long id, HttpServletResponse res) {
      Video video = null;
      Response response = null;
      video = videos.get(id - 1);
      if (video == null) {
        // TODO how to return 404 status
      }
      serveSomeVideo(video, res);
      VideoSvcApi client =  new RestAdapter.Builder()
              .setEndpoint("http://localhost:8080").build().create(VideoSvcApi.class);
      response = client.getData(video.getId());
      return response;
  }
  
  public void serveSomeVideo(Video v, HttpServletResponse response) throws IOException  {
      if (videoDataMgr == null) {
          videoDataMgr = VideoFileManager.get();
      }
      response.addHeader("Content-Type", v.getContentType());
      videoDataMgr.copyVideoData(v, response.getOutputStream());
      response.setStatus(200);
      response.addHeader("Content-Type", v.getContentType());
  }
  </code></pre>
  
  <p>I tried some typical approaches as:</p>
  
  <blockquote>
    <p>res.setStatus(HttpStatus.NOT_FOUND.value());<br>
    new ResponseEntity(HttpStatus.BAD_REQUEST);</p>
  </blockquote>
  
  <p>but I need to return <a href="http://square.github.io/retrofit/javadoc/retrofit/client/Response.html" rel="noreferrer">Response</a>.</p>
  
  <p><strong><em>How to return here 404 status code if video is null?</em></strong></p>