Return-Path: X-Original-To: apmail-incubator-jspwiki-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-jspwiki-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 919F2D802 for ; Tue, 12 Feb 2013 17:51:52 +0000 (UTC) Received: (qmail 22862 invoked by uid 500); 12 Feb 2013 17:51:52 -0000 Delivered-To: apmail-incubator-jspwiki-commits-archive@incubator.apache.org Received: (qmail 22835 invoked by uid 500); 12 Feb 2013 17:51:52 -0000 Mailing-List: contact jspwiki-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jspwiki-dev@incubator.apache.org Delivered-To: mailing list jspwiki-commits@incubator.apache.org Received: (qmail 22828 invoked by uid 99); 12 Feb 2013 17:51:52 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Feb 2013 17:51:52 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Feb 2013 17:51:48 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id C91EE238896F; Tue, 12 Feb 2013 17:51:28 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1445289 - in /incubator/jspwiki/trunk: ChangeLog build.xml src/org/apache/wiki/Release.java src/org/apache/wiki/ui/WikiJSPFilter.java src/org/apache/wiki/util/UtilJ2eeCompat.java Date: Tue, 12 Feb 2013 17:51:28 -0000 To: jspwiki-commits@incubator.apache.org From: metskem@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130212175128.C91EE238896F@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: metskem Date: Tue Feb 12 17:51:28 2013 New Revision: 1445289 URL: http://svn.apache.org/r1445289 Log: 2013-02-12 Harry Metske * 2.9.1-svn-25 * JSPWIKI-759 Resin 4 Compatibility (thanks to Paul Cowan) * build.xml tweak: shut down the Jetty test server after the last webtest Modified: incubator/jspwiki/trunk/ChangeLog incubator/jspwiki/trunk/build.xml incubator/jspwiki/trunk/src/org/apache/wiki/Release.java incubator/jspwiki/trunk/src/org/apache/wiki/ui/WikiJSPFilter.java incubator/jspwiki/trunk/src/org/apache/wiki/util/UtilJ2eeCompat.java Modified: incubator/jspwiki/trunk/ChangeLog URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/ChangeLog?rev=1445289&r1=1445288&r2=1445289&view=diff ============================================================================== --- incubator/jspwiki/trunk/ChangeLog (original) +++ incubator/jspwiki/trunk/ChangeLog Tue Feb 12 17:51:28 2013 @@ -1,3 +1,10 @@ +2013-02-12 Harry Metske + + * 2.9.1-svn-25 + + * JSPWIKI-759 Resin 4 Compatibility (thanks to Paul Cowan) + * build.xml tweak: shut down the Jetty test server after the last webtest + 2013-02-08 Juan Pablo Santos (juanpablo AT apache DOT org) * 2.9.1-svn-24 Modified: incubator/jspwiki/trunk/build.xml URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/build.xml?rev=1445289&r1=1445288&r2=1445289&view=diff ============================================================================== --- incubator/jspwiki/trunk/build.xml (original) +++ incubator/jspwiki/trunk/build.xml Tue Feb 12 17:51:28 2013 @@ -963,7 +963,11 @@ - + + + + + The web unit tests have finished. You can find the test reports in ${webtests.reports}. If all of the tests ran successfully, the reports will all be "green." @@ -1075,8 +1079,7 @@ If all of the tests ran successfully, th - + Modified: incubator/jspwiki/trunk/src/org/apache/wiki/Release.java URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/Release.java?rev=1445289&r1=1445288&r2=1445289&view=diff ============================================================================== --- incubator/jspwiki/trunk/src/org/apache/wiki/Release.java (original) +++ incubator/jspwiki/trunk/src/org/apache/wiki/Release.java Tue Feb 12 17:51:28 2013 @@ -75,7 +75,7 @@ public final class Release *

* If the build identifier is empty, it is not added. */ - public static final String BUILD = "24"; + public static final String BUILD = "25"; /** * This is the generic version string you should use Modified: incubator/jspwiki/trunk/src/org/apache/wiki/ui/WikiJSPFilter.java URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/ui/WikiJSPFilter.java?rev=1445289&r1=1445288&r2=1445289&view=diff ============================================================================== --- incubator/jspwiki/trunk/src/org/apache/wiki/ui/WikiJSPFilter.java (original) +++ incubator/jspwiki/trunk/src/org/apache/wiki/ui/WikiJSPFilter.java Tue Feb 12 17:51:28 2013 @@ -126,7 +126,18 @@ public class WikiJSPFilter extends WikiS // response.setContentLength(r.length()); // response.setContentType(encoding); - response.getWriter().write(r); + if (m_useOutputStream) + { + OutputStreamWriter out = new OutputStreamWriter(response.getOutputStream(), + response.getCharacterEncoding()); + out.write(r); + out.flush(); + out.close(); + } + else + { + response.getWriter().write(r); + } // Clean up the UI messages and loggers if( wikiContext != null ) @@ -248,6 +259,8 @@ public class WikiJSPFilter extends WikiS extends HttpServletResponseWrapper { private CharArrayWriter m_output; + private MyServletOutputStream m_servletOut; + private PrintWriter m_writer; /** * How large the initial buffer should be. This should be tuned to achieve @@ -259,6 +272,8 @@ public class WikiJSPFilter extends WikiS { super(r); m_output = new CharArrayWriter( INIT_BUFFER_SIZE ); + m_servletOut = new MyServletOutputStream(m_output); + m_writer = new PrintWriter(m_servletOut, true); } /** @@ -267,15 +282,21 @@ public class WikiJSPFilter extends WikiS */ public PrintWriter getWriter() { - return new PrintWriter( m_output ); + return m_writer; } public ServletOutputStream getOutputStream() { - return new MyServletOutputStream( m_output ); + return m_servletOut; + } + + public void flushBuffer() throws IOException + { + m_writer.flush(); + super.flushBuffer(); } - static class MyServletOutputStream extends ServletOutputStream + class MyServletOutputStream extends ServletOutputStream { CharArrayWriter m_buffer; @@ -285,11 +306,11 @@ public class WikiJSPFilter extends WikiS m_buffer = aCharArrayWriter; } - public void write(int aInt) + @Override + public void write(int aInt) throws IOException { m_buffer.write( aInt ); } - } /** @@ -297,6 +318,16 @@ public class WikiJSPFilter extends WikiS */ public String toString() { + try + { + flushBuffer(); + } + catch( IOException e ) + { + log.error( MyServletResponseWrapper.class + " toString() flushBuffer() Failed", e ); + return null; + } + return m_output.toString(); } } @@ -308,8 +339,11 @@ public class WikiJSPFilter extends WikiS private static class ByteArrayResponseWrapper extends HttpServletResponseWrapper { - private ByteArrayOutputStream m_output; private HttpServletResponse m_response; + + private ByteArrayOutputStream m_output; + private MyServletOutputStream m_servletOut; + private PrintWriter m_writer; /** * How large the initial buffer should be. This should be tuned to achieve @@ -321,6 +355,8 @@ public class WikiJSPFilter extends WikiS { super(r); m_output = new ByteArrayOutputStream( INIT_BUFFER_SIZE ); + m_servletOut = new MyServletOutputStream(m_output); + m_writer = new PrintWriter(m_servletOut, true); m_response = r; } @@ -330,25 +366,32 @@ public class WikiJSPFilter extends WikiS */ public PrintWriter getWriter() { - return new PrintWriter( getOutputStream(), true ); + return m_writer; } public ServletOutputStream getOutputStream() { - return new MyServletOutputStream( m_output ); + return m_servletOut; + } + + public void flushBuffer() throws IOException + { + m_writer.flush(); + super.flushBuffer(); } - static class MyServletOutputStream extends ServletOutputStream + class MyServletOutputStream extends ServletOutputStream { - private DataOutputStream m_stream; + private OutputStream m_stream; public MyServletOutputStream( OutputStream aOutput ) { super(); - m_stream = new DataOutputStream( aOutput ); + m_stream = aOutput; } - public void write( int aInt ) throws IOException + @Override + public void write(int aInt) throws IOException { m_stream.write( aInt ); } @@ -361,6 +404,7 @@ public class WikiJSPFilter extends WikiS { try { + flushBuffer(); return m_output.toString( m_response.getCharacterEncoding() ); } catch( UnsupportedEncodingException e ) @@ -368,6 +412,11 @@ public class WikiJSPFilter extends WikiS log.error( ByteArrayResponseWrapper.class + " Unsupported Encoding", e ); return null; } + catch( IOException e ) + { + log.error( ByteArrayResponseWrapper.class + " toString() Flush Failed", e ); + return null; + } } } Modified: incubator/jspwiki/trunk/src/org/apache/wiki/util/UtilJ2eeCompat.java URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/util/UtilJ2eeCompat.java?rev=1445289&r1=1445288&r2=1445289&view=diff ============================================================================== --- incubator/jspwiki/trunk/src/org/apache/wiki/util/UtilJ2eeCompat.java (original) +++ incubator/jspwiki/trunk/src/org/apache/wiki/util/UtilJ2eeCompat.java Tue Feb 12 17:51:28 2013 @@ -101,6 +101,8 @@ public class UtilJ2eeCompat if( serverInfo.indexOf( RESIN ) >= 0 ) { log.info( RESIN + " detected" ); + // use response.getOutputStream instead of response.getWriter + useStream = true; } else if( serverInfo.indexOf( REX_IP ) >= 0 ) {