title: Spring @RestController Get Request Content-Type to response json or html
body: <p>how can I take request Content-Type value? We need this to print json response or Html respone. My code is this:</p>
  
  <pre><code> @RestController
  public class GestorController {
      @RequestMapping(value="/gestores", method = RequestMethod.GET)  
      public Object gestoresHtml(@RequestParam(value="name", required=false, defaultValue="sh14") String name) throws Exception {
          String json = "prueba json";
  
          String contentType = ?????
  
          if(contentType.equals("application/json")){
              return json;
          }else{
              ModelAndView mav = new ModelAndView();
              mav.setViewName("gestores");
              mav.addObject("name", name);
              return mav;
          }
      }
  }
  </code></pre>
  
  <p>Thanks for all.</p>