| 522 | |
| 523 | |
| 524 | @Override |
| 525 | public PrintWriter getWriter() throws IOException { |
| 526 | |
| 527 | if (usingOutputStream) { |
| 528 | throw new IllegalStateException(sm.getString("coyoteResponse.getWriter.ise")); |
| 529 | } |
| 530 | |
| 531 | if (request.getConnector().getEnforceEncodingInGetWriter()) { |
| 532 | /* |
| 533 | * If the response's character encoding has not been specified as described in |
| 534 | * <code>getCharacterEncoding</code> (i.e., the method just returns the default value |
| 535 | * <code>ISO-8859-1</code>), <code>getWriter</code> updates it to <code>ISO-8859-1</code> (with the effect |
| 536 | * that a subsequent call to getContentType() will include a charset=ISO-8859-1 component which will also be |
| 537 | * reflected in the Content-Type response header, thereby satisfying the Servlet spec requirement that |
| 538 | * containers must communicate the character encoding used for the servlet response's writer to the client). |
| 539 | */ |
| 540 | setCharacterEncoding(getCharacterEncoding()); |
| 541 | } |
| 542 | |
| 543 | usingWriter = true; |
| 544 | outputBuffer.checkConverter(); |
| 545 | if (writer == null) { |
| 546 | writer = new CoyoteWriter(outputBuffer); |
| 547 | } |
| 548 | return writer; |
| 549 | } |
| 550 | |
| 551 | |
| 552 | @Override |