[Winstone-devel] winstone/src/java/winstone WinstoneOutputStream.java, 1.16, 1.17 WinstoneResponse.
Status: Beta
Brought to you by:
rickknowles
From: Rick K. <ric...@us...> - 2006-08-10 15:17:43
|
Update of /cvsroot/winstone/winstone/src/java/winstone In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv15388/src/java/winstone Modified Files: WinstoneOutputStream.java WinstoneResponse.java Log Message: Harmony bug fix, plus some moving of header checks to outside the include status Index: WinstoneOutputStream.java =================================================================== RCS file: /cvsroot/winstone/winstone/src/java/winstone/WinstoneOutputStream.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** WinstoneOutputStream.java 10 Aug 2006 06:38:30 -0000 1.16 --- WinstoneOutputStream.java 10 Aug 2006 15:17:39 -0000 1.17 *************** *** 223,227 **** topStream = (OutputStream) this.includeByteStreams.peek(); } ! topStream.write(body.toByteArray()); body.close(); } --- 223,230 ---- topStream = (OutputStream) this.includeByteStreams.peek(); } ! byte bodyArr[] = body.toByteArray(); ! if (bodyArr.length > 0) { ! topStream.write(bodyArr); ! } body.close(); } Index: WinstoneResponse.java =================================================================== RCS file: /cvsroot/winstone/winstone/src/java/winstone/WinstoneResponse.java,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** WinstoneResponse.java 10 Aug 2006 13:17:35 -0000 1.35 --- WinstoneResponse.java 10 Aug 2006 15:17:39 -0000 1.36 *************** *** 234,243 **** Logger.log(Logger.FULL_DEBUG, Launcher.RESOURCES, "WinstoneResponse.ForcingContentLength", "" + bodyBytes); ! setContentLength(bodyBytes); lengthHeader = getHeader(CONTENT_LENGTH_HEADER); } } ! setHeader(KEEP_ALIVE_HEADER, !closeAfterRequest() ? KEEP_ALIVE_OPEN : KEEP_ALIVE_CLOSE); String contentType = getHeader(CONTENT_TYPE_HEADER); if ((contentType == null) && (this.statusCode != SC_MOVED_TEMPORARILY)) { --- 234,243 ---- Logger.log(Logger.FULL_DEBUG, Launcher.RESOURCES, "WinstoneResponse.ForcingContentLength", "" + bodyBytes); ! setHeader(CONTENT_LENGTH_HEADER, "" + bodyBytes, true); lengthHeader = getHeader(CONTENT_LENGTH_HEADER); } } ! setHeader(KEEP_ALIVE_HEADER, !closeAfterRequest() ? KEEP_ALIVE_OPEN : KEEP_ALIVE_CLOSE, true); String contentType = getHeader(CONTENT_TYPE_HEADER); if ((contentType == null) && (this.statusCode != SC_MOVED_TEMPORARILY)) { *************** *** 245,254 **** String enc = getCurrentEncoding(); setHeader(CONTENT_TYPE_HEADER, "text/html" + ! (enc == null ? "" : ";charset=" + enc)); } if (getHeader(DATE_HEADER) == null) ! setDateHeader(DATE_HEADER, System.currentTimeMillis()); if (getHeader(X_POWERED_BY_HEADER) == null) ! setHeader(X_POWERED_BY_HEADER, POWERED_BY_WINSTONE); if (this.locale != null) { String lang = this.locale.getLanguage(); --- 245,254 ---- String enc = getCurrentEncoding(); setHeader(CONTENT_TYPE_HEADER, "text/html" + ! (enc == null ? "" : ";charset=" + enc), true); } if (getHeader(DATE_HEADER) == null) ! setHeader(DATE_HEADER, formatHeaderDate(new Date()), true); if (getHeader(X_POWERED_BY_HEADER) == null) ! setHeader(X_POWERED_BY_HEADER, POWERED_BY_WINSTONE, true); if (this.locale != null) { String lang = this.locale.getLanguage(); *************** *** 256,260 **** lang = lang + "-" + this.locale.getCountry(); } ! setHeader(CONTENT_LANGUAGE_HEADER, lang); } --- 256,260 ---- lang = lang + "-" + this.locale.getCountry(); } ! setHeader(CONTENT_LANGUAGE_HEADER, lang, true); } *************** *** 520,524 **** Logger.log(Logger.FULL_DEBUG, Launcher.RESOURCES, "WinstoneResponse.GetWriter"); WinstoneOutputStream outStream = getTopOutputStream(); - // PrintWriter outWriter = (PrintWriter) this.outPrintWriters.get(outStream); if (this.outputWriter != null) return this.outputWriter; --- 520,523 ---- *************** *** 526,531 **** this.outputWriter = new WinstoneResponseWriter(outStream, this); return this.outputWriter; - // this.outPrintWriters.put(outStream, outWriter); - // return outWriter; } } --- 525,528 ---- *************** *** 556,565 **** this.outputWriter.flush(); } - // PrintWriter mainOutWriter = (PrintWriter) this.outPrintWriters.get(this.outputStream); - // this.outPrintWriters.clear(); - // if (mainOutWriter != null) { - // mainOutWriter.flush(); - // this.outPrintWriters.put(this.outputStream, mainOutWriter); - // } this.outputStream.setDisregardMode(false); --- 553,556 ---- *************** *** 631,635 **** public void setHeader(String name, String value) { ! if (isIncluding()) { Logger.log(Logger.DEBUG, Launcher.RESOURCES, "WinstoneResponse.HeaderInInclude", new String[] {name, value}); --- 622,629 ---- public void setHeader(String name, String value) { ! setHeader(name, value, false); ! } ! private void setHeader(String name, String value, boolean ignoreInclude) { ! if (!ignoreInclude && isIncluding()) { Logger.log(Logger.DEBUG, Launcher.RESOURCES, "WinstoneResponse.HeaderInInclude", new String[] {name, value}); |