code: protected void setContentType (HttpServletRequest request, HttpServletResponse response)
      {
          String contentType = _defaultContentType;
          int index = contentType.lastIndexOf(';') + 1;
          if (index <= 0 || (index < contentType.length() &&
                             contentType.indexOf("charset", index) == -1)) {
              // append the character encoding which we'd like to use
              String encoding = chooseCharacterEncoding(request);
              if (!DEFAULT_OUTPUT_ENCODING.equalsIgnoreCase(encoding)) {
                  contentType += "; charset=" + encoding;
              }
          }
          response.setContentType(contentType);
      }
docs: Sets the content type of the response, defaulting to {@link #_defaultContentType} if not
  overriden. Delegates to {@link #chooseCharacterEncoding(HttpServletRequest)} to select the
  appropriate character encoding.