[Statelessfilter-commits] SF.net SVN: statelessfilter:[68] trunk/stateless-core/src/main/java/net/
Status: Beta
Brought to you by:
nricheton
|
From: <nri...@us...> - 2011-02-23 16:26:19
|
Revision: 68
http://statelessfilter.svn.sourceforge.net/statelessfilter/?rev=68&view=rev
Author: nricheton
Date: 2011-02-23 16:26:12 +0000 (Wed, 23 Feb 2011)
Log Message:
-----------
https://sourceforge.net/apps/mantisbt/statelessfilter/view.php?id=22 : round 2
Modified Paths:
--------------
trunk/stateless-core/src/main/java/net/sourceforge/statelessfilter/wrappers/BufferedHttpResponseWrapper.java
Modified: trunk/stateless-core/src/main/java/net/sourceforge/statelessfilter/wrappers/BufferedHttpResponseWrapper.java
===================================================================
--- trunk/stateless-core/src/main/java/net/sourceforge/statelessfilter/wrappers/BufferedHttpResponseWrapper.java 2011-02-23 14:53:46 UTC (rev 67)
+++ trunk/stateless-core/src/main/java/net/sourceforge/statelessfilter/wrappers/BufferedHttpResponseWrapper.java 2011-02-23 16:26:12 UTC (rev 68)
@@ -46,11 +46,15 @@
@Override
public void flushBuffer() throws IOException {
+
if (this.outputStream != null) {
this.outputStream.flush();
} else if (this.printWriter != null) {
this.printWriter.flush();
+ bufferedServletOut.flush();
}
+
+
}
public byte[] getBuffer() {
@@ -65,37 +69,36 @@
@Override
public ServletOutputStream getOutputStream() throws IOException {
- synchronized (this) {
- if (this.printWriter != null) {
- throw new IllegalStateException(
- "The Servlet API forbids calling getOutputStream( ) after" //$NON-NLS-1$
- + " getWriter( ) has been called"); //$NON-NLS-1$
- }
+ if (this.printWriter != null) {
+ throw new IllegalStateException(
+ "The Servlet API forbids calling getOutputStream( ) after" //$NON-NLS-1$
+ + " getWriter( ) has been called"); //$NON-NLS-1$
+ }
- if (this.outputStream == null) {
- this.outputStream = this.bufferedServletOut;
- }
+ if (this.outputStream == null) {
+ this.outputStream = this.bufferedServletOut;
}
+
return this.outputStream;
}
@Override
public PrintWriter getWriter() throws IOException {
- synchronized (this) {
- if (this.outputStream != null) {
- throw new IllegalStateException(
- "The Servlet API forbids calling getWriter( ) after" //$NON-NLS-1$
- + " getOutputStream( ) has been called"); //$NON-NLS-1$
- }
- if (this.printWriter == null) {
- // Create writer with the response encoding.
- Writer writer = new OutputStreamWriter(this.bufferedServletOut,
- this.getResponse().getCharacterEncoding());
+ if (this.outputStream != null) {
+ throw new IllegalStateException(
+ "The Servlet API forbids calling getWriter( ) after" //$NON-NLS-1$
+ + " getOutputStream( ) has been called"); //$NON-NLS-1$
+ }
- this.printWriter = new PrintWriter(writer);
- }
+ if (this.printWriter == null) {
+ // Create writer with the response encoding.
+ Writer writer = new OutputStreamWriter(this.bufferedServletOut,
+ this.getResponse().getCharacterEncoding());
+
+ this.printWriter = new PrintWriter(writer);
}
+
return this.printWriter;
}
@@ -117,6 +120,9 @@
@Override
public void reset() {
this.bufferedServletOut.reset();
+ errorCode = null;
+ errorMsg = null;
+ location = null;
}
@Override
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|