Revision: 1240
http://stripes.svn.sourceforge.net/stripes/?rev=1240&view=rev
Author: bengunter
Date: 2010-05-21 15:59:32 +0000 (Fri, 21 May 2010)
Log Message:
-----------
STS-391: Avoid unnecessary flushes by only entering/exiting silent mode if the
requested mode differs from the current mode.
Modified Paths:
--------------
branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/layout/LayoutWriter.java
Modified:
branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/layout/LayoutWriter.java
===================================================================
---
branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/layout/LayoutWriter.java
2010-05-21 15:44:28 UTC (rev 1239)
+++
branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/layout/LayoutWriter.java
2010-05-21 15:59:32 UTC (rev 1240)
@@ -58,18 +58,20 @@
* before silent mode is enabled to ensure all buffered data are written.
*/
public void setSilent(boolean silent, PageContext context) {
- try {
- if (context != null)
- context.getOut().flush();
+ if (silent != this.silent) {
+ try {
+ if (context != null)
+ context.getOut().flush();
+ }
+ catch (IOException e) {
+ // This seems to happen once at the beginning and once at the
end. Don't know why.
+ log.debug("Failed to flush buffer: ", e.getMessage());
+ }
+ finally {
+ this.silent = silent;
+ log.trace("Output is " + (silent ? "DISABLED" : "ENABLED"));
+ }
}
- catch (IOException e) {
- // This seems to happen once at the beginning and once at the end.
Don't know why.
- log.debug("Failed to flush buffer: ", e.getMessage());
- }
- finally {
- this.silent = silent;
- log.trace("Output is " + (silent ? "DISABLED" : "ENABLED"));
- }
}
@Override
@@ -82,6 +84,15 @@
out.flush();
}
+ /**
+ * Calls {...@link JspWriter#clear()} on the wrapped JSP writer.
+ *
+ * @throws IOException
+ */
+ public void clear() throws IOException {
+ out.clear();
+ }
+
@Override
public void write(char[] cbuf, int off, int len) throws IOException {
if (!isSilent())
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development