Revision: 556
http://svn.sourceforge.net/stripes/?rev=556&view=rev
Author: bengunter
Date: 2007-05-26 08:56:40 -0700 (Sat, 26 May 2007)
Log Message:
-----------
Merged fix for STS-370 from trunk.
Modified Paths:
--------------
branches/1.4.x/stripes/src/net/sourceforge/stripes/controller/StripesFilter.java
Modified:
branches/1.4.x/stripes/src/net/sourceforge/stripes/controller/StripesFilter.java
===================================================================
---
branches/1.4.x/stripes/src/net/sourceforge/stripes/controller/StripesFilter.java
2007-05-26 15:45:50 UTC (rev 555)
+++
branches/1.4.x/stripes/src/net/sourceforge/stripes/controller/StripesFilter.java
2007-05-26 15:56:40 UTC (rev 556)
@@ -60,9 +60,22 @@
* Configuration. Doing this allows multiple Stripes Configurations to
exist in a single
* Classloader since the Configuration is not located statically.
*/
- private static ThreadLocal<Configuration> configurationStash = new
ThreadLocal<Configuration>();
+ private static final ThreadLocal<Configuration> configurationStash = new
ThreadLocal<Configuration>();
/**
+ * Some operations should only be done if the current invocation of
+ * [EMAIL PROTECTED] #doFilter(ServletRequest, ServletResponse,
FilterChain)} is the
+ * first in the filter chain. This [EMAIL PROTECTED] ThreadLocal} keeps
track of
+ * whether such operations should be done or not.
+ */
+ private static final ThreadLocal<Boolean> initialInvocation = new
ThreadLocal<Boolean>() {
+ @Override
+ protected Boolean initialValue() {
+ return true;
+ }
+ };
+
+ /**
* Performs the necessary initialization for the StripesFilter. Mainly
this involves deciding
* what configuration class to use, and then instantiating and
initializing the chosen
* Configuration.
@@ -143,6 +156,12 @@
HttpServletRequest httpRequest = (HttpServletRequest) servletRequest;
HttpServletResponse httpResponse = (HttpServletResponse)
servletResponse;
+ // check the flag that indicates if this is the initial invocation
+ boolean initial = initialInvocation.get();
+ if (initial) {
+ initialInvocation.set(false);
+ }
+
// Wrap pretty much everything in a try/catch so that we can funnel
even the most
// bizarre or unexpected exceptions into the exception handler
try {
@@ -183,8 +202,13 @@
this.configuration.getExceptionHandler().handle(t, httpRequest,
httpResponse);
}
finally {
+ // reset the flag that indicates if this is the initial invocation
+ if (initial) {
+ initialInvocation.set(true);
+ flashOutbound(httpRequest);
+ }
+
// Once the request is processed, take the Configuration back out
of thread local
- flashOutbound(httpRequest);
StripesFilter.configurationStash.set(null);
}
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development