docs: public PrintWriter getWriter() throws IOException, UnsupportedEncodingException {
          final boolean isTraceOn = com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled();
          if (isTraceOn&&logger.isLoggable (Level.FINE))  //306998.15
              logger.entering(CLASS_NAME,"getWriter","gotOutputStream="+String.valueOf(_gotOutputStream)+" ["+this+"]");
  
          if (!_ignoreStateErrors && _gotOutputStream) {
  
              if (isTraceOn&&logger.isLoggable (Level.FINE))  //306998.15
                  logger.exiting(CLASS_NAME,"getWriter","throw IllegalStateException");
  
              throw new IllegalStateException(nls.getString("OutputStream.already.obtained", "OutputStream already obtained"));
          }
          if (!_gotWriter) {
              String charEncoding = getCharacterEncoding();
  
              // begin 249506, part 1 Set content-type charset if not set already
              // begin PK27527  DEFAULT CONTENT-TYPE SETTING ON WEBSPHERE V6.0.X IS "TEXT/PLAN"
              // only add charset if we are in v6 mode.
              if (contentTypeCompatibility==null || (!contentTypeCompatibility.equalsIgnoreCase("V4")&&
                              !contentTypeCompatibility.equalsIgnoreCase("V5"))){
                  String contentType = getContentType();
                  //PK33871 - added check to make sure the content type started with 'text'.
                  if (contentType!=null && contentType.indexOf("charset")==-1 && contentType.startsWith(WebContainerConstants.TEXT))  
                  {
                      if (contentType.endsWith(";"))
                          setContentType(contentType + "charset=" + charEncoding);
                      else
                          setContentType(contentType + ";charset=" + charEncoding);
                  }
              }
              // end PK27527  DEFAULT CONTENT-TYPE SETTING ON WEBSPHERE V6.0.X IS "TEXT/PLAN"  
              // end 249506, part 1
  
              //              if ((_outWriter == null) || (writerClosed == true) || (!charEncoding.equals(_outWriterEncoding)))
              if ((_outWriter == null) || (writerException == true) || (!charEncoding.equals(_outWriterEncoding))) {
                  if (isTraceOn&&logger.isLoggable (Level.FINE) && writerException){  //306998.15
                      logger.logp(Level.FINE, CLASS_NAME,"getWriter", "writerException --> " + writerException + "--> creating new OutputStreamWriter");
                  }
                  _outWriter = new OutputStreamWriter(_rawOut, EncodingUtils.getJvmConverter(charEncoding));
                  _outWriterEncoding = charEncoding;
                  writerException = false;
              }
              else{
                  if (isTraceOn&&logger.isLoggable (Level.FINE)){  //306998.15
                      logger.logp(Level.FINE, CLASS_NAME,"getWriter", "reusing _outWriter: --> " + _outWriter);
                  }
              }
  
              if (isTraceOn&&logger.isLoggable (Level.FINE))  //306998.15
                  logger.logp(Level.FINE, CLASS_NAME,"getWriter", "created writer with encoding: " + _outWriter.getEncoding());
  
              _bufferedWriter.init(_outWriter, getBufferSize());
              _bufferedWriter.setLimitLong(_contentLength);
              _bufferedWriter.setResponse(_response);
  
              _pwriter = new PrintWriter(_bufferedWriter, false);
              // LIBERTY _responseBuffer = _bufferedWriter;
              _gotWriter = true;
  
              writerClosed = false;
          }
          this.fireWriterRetrievedEvent(_pwriter);
          if (isTraceOn&&logger.isLoggable (Level.FINE))  //306998.15
              logger.exiting(CLASS_NAME,"getWriter");
          return _pwriter;
      }