You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by eh...@apache.org on 2007/08/29 11:05:43 UTC

svn commit: r570714 - /wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java

Author: ehillenius
Date: Wed Aug 29 02:05:42 2007
New Revision: 570714

URL: http://svn.apache.org/viewvc?rev=570714&view=rev
Log:
WICKET-903

Modified:
    wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java

Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java?rev=570714&r1=570713&r2=570714&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java Wed Aug 29 02:05:42 2007
@@ -186,6 +186,14 @@
 	public void doGet(final HttpServletRequest servletRequest,
 			final HttpServletResponse servletResponse) throws ServletException, IOException
 	{
+		// if called externally (i.e. WicketServlet) we need to set the thread local here
+		// AND clean it up at the end of the request
+		boolean externalCall = !Application.exists();
+		if (externalCall)
+		{
+			Application.set(webApplication);
+		}
+
 		String relativePath = getRelativePath(servletRequest);
 
 		// Special-case for home page - we redirect to add a trailing slash.
@@ -303,8 +311,12 @@
 				// Clean up thread local session
 				Session.unset();
 
-				// Clean up thread local application
-				Application.unset();
+				if (externalCall)
+				{
+					// Clean up thread local application if this was an external call
+					// (if not, doFilter will clean it up)
+					Application.unset();
+				}
 			}
 		}
 		finally