code: @Override
      public void setContentType(String value) {
          if (isCommitted()) {
              return;
          }
          if (null == value) {
              if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                  Tr.debug(tc, "setContentType: null, removing header");
              }
              this.response.removeHeader("Content-Type");
              return;
          }
          boolean addEncoding = false;
          String type = value;
  
          // see if the input value contains a charset
          int charsetIndex = value.indexOf("charset=");
          if (-1 != charsetIndex) {
              if (null == this.outWriter) {
                  // can update both mime-set and charset
                  addEncoding = true;
                  this.encoding = connection.getEncodingUtils().stripQuotes(value.substring(charsetIndex + 8));
              } else {
                  // can only update the mimeset so strip the charset off
                  type = value.substring(0, charsetIndex).trim();
                  charsetIndex = -1;
              }
          }
          if (null != this.outWriter) {
              // can still update the mime-type but not charset
              addEncoding = true;
          } else {
              // TODO don't quite follow why webcontainer checks for text*
              if (type.startsWith("text")) {
                  addEncoding = true;
              }
          }
          if (addEncoding) {
              if (-1 != charsetIndex) {
                  type = type.substring(0, charsetIndex - 1);
              }
              if (this.encoding != null) {
                  type = type + ";charset=" + this.encoding;
              }
          }
          this.contentType = type;
          this.response.setHeader("Content-Type", type);
      }
docs: /*
  @see javax.servlet.ServletResponse#setContentType(java.lang.String)