title: Do I need to set response header in Spring contoller
body: <p>My controller is like this</p>
  
  <pre><code>@RequestMapping(value ="/getTaggedProducts", method = RequestMethod.GET)
  @ResponseBody
  public String getProductsTagged(@RequestParam("questionnaireId")Long questionnaireId){
      Map&lt;String, Object&gt; response = new HashMap&lt;String, Object&gt;();
      try{
          Questionnaire questionnaireProduct = Questionnaire.findQuestionnaire(questionnaireId);
          Organisation userOrg = getUserAffiliation();
  
          if (questionnaireProduct == null) throw new QuestionnaireBuilderException("Questionnaire '" + questionnaireId + "'does not exist");
          if (!questionnaireProduct.isEditable()) throw new QuestionnaireBuilderException("You cannot edit a questionnaire which has been assigned");
  
          Set&lt;Product&gt; productCategories = questionnaireProduct.getProducts();
          List&lt;Long&gt; productIds = new ArrayList&lt;Long&gt;();
          for(Product p: productCategories){
              productIds.add(p.getId());
          }
  
          LOG.debug("Product Categories successfully added to questionnaire");
          response.put("message", "success");
          response.put("products", productIds);
      } catch (QuestionnaireBuilderException e) {
          LOG.debug(e.getMessage(), e);
          response.put("message", e.getMessage());
      } catch (Exception e) {
          LOG.error("Unhandled Exception: " + e.getMessage(), e);
          response.put("message", "Unhandled Exception");
      }
      return new JSONSerializer().exclude("*.class").deepSerialize(response);
  }
  </code></pre>
  
  <p>Will not setting a response header pose any problems. I know how to set the response header from this question - <a href="https://stackoverflow.com/questions/4471584/in-spring-mvc-how-can-i-set-the-mime-type-header-when-using-responsebody">In Spring MVC, how can I set the mime type header when using @ResponseBody</a>
  In my ajax call I specify</p>
  
  <pre><code>datatype: "json"
  </code></pre>
  
  <p>Is this sufficient or I need to set the header too. Thanks</p>