You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by me...@apache.org on 2013/02/12 18:51:28 UTC
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
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 <me...@apache.org>
* 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 <me...@apache.org>
+
+ * 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 @@
<webtest-exec context="test-custom-jdbc" />
<webtest-exec context="test-container-jdbc" />
<webtest-exec context="test-custom-absolute" />
-
+
+ <!-- Shut down the embedded Jetty server by sending the shutdown command -->
+ <echo message="Shutting down Jetty (if it is up)."/>
+ <get src="http://localhost:${webtests.port}/GO_AWAY/" dest="${webtests.temp}/shutdown.log" ignoreerrors="true" verbose="true" />
+
<echo>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."</echo>
@@ -1075,8 +1079,7 @@ If all of the tests ran successfully, th
<sequential>
<!-- If already running, shut down the embedded Jetty server by sending the shutdown command -->
<echo message="Shutting down Jetty (if it is up)."/>
- <get src="http://localhost:${webtests.port}/GO_AWAY/" dest="${webtests.temp}/shutdown.log"
- ignoreerrors="true" verbose="true" />
+ <get src="http://localhost:${webtests.port}/GO_AWAY/" dest="${webtests.temp}/shutdown.log" ignoreerrors="true" verbose="true" />
<sleep seconds="3"/>
<!-- Start Jetty with our test context -->
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
* <p>
* 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 )
{