title: Return a 302 status code in Spring MVC Controller
body: <p>I am developing a Spring MVC app, and I need to check in my controller a certain condition. In case it were true, I have to return a 302 status code. It's something like this:</p>
  
  <pre><code>@RequestMapping(value = "/mypath.shtml", method = RequestMethod.GET)
  public ModelAndView pageHandler(@Valid MyForm form, BindingResult result, HttpServletRequest request,
          Locale locale) throws PageControllerException, InvalidPageContextException, ServiceException {
  
      if (someCondition){
          // return 302 status code
      }
      else{
          // Do some stuff
      }
  }
  </code></pre>
  
  <p>Which is the best way to do this?</p>
  
  <p>Thank you very much in advance</p>