You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by kn...@apache.org on 2007/12/07 01:36:22 UTC

svn commit: r601930 - /wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/servlet/WicketSessionFilter.java

Author: knopp
Date: Thu Dec  6 16:36:21 2007
New Revision: 601930

URL: http://svn.apache.org/viewvc?rev=601930&view=rev
Log:
Unset the session after the chained filter is done

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

Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/servlet/WicketSessionFilter.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/servlet/WicketSessionFilter.java?rev=601930&r1=601929&r2=601930&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/servlet/WicketSessionFilter.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/servlet/WicketSessionFilter.java Thu Dec  6 16:36:21 2007
@@ -82,14 +82,13 @@
  * public class HelloWorldServlet extends HttpServlet
  * {
  * 	public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException,
- * 			IOException
+ * 		IOException
  * 	{
  * 		res.setContentType("text/html");
  * 		PrintWriter out = res.getWriter();
  * 		String message = "Hi. " +
- * 				(Session.exists()
- * 						? " I know Wicket session " + Session.get() + "."
- * 						: " I can't find a Wicket session.");
+ * 			(Session.exists() ? " I know Wicket session " + Session.get() + "."
+ * 				: " I can't find a Wicket session.");
  * 		out.println(message);
  * 		out.close();
  * 	}
@@ -132,8 +131,8 @@
 		if (filterName == null)
 		{
 			throw new ServletException(
-					"you must provide init parameter 'filterName if you want to use " +
-							getClass().getName());
+				"you must provide init parameter 'filterName if you want to use " +
+					getClass().getName());
 		}
 
 		if (log.isDebugEnabled())
@@ -154,7 +153,7 @@
 	 *      javax.servlet.ServletResponse, javax.servlet.FilterChain)
 	 */
 	public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
-			throws IOException, ServletException
+		throws IOException, ServletException
 	{
 		HttpServletRequest httpServletRequest = ((HttpServletRequest)request);
 		HttpSession httpSession = httpServletRequest.getSession(false);
@@ -169,8 +168,8 @@
 				if (log.isDebugEnabled())
 				{
 					log.debug("session " + session + " set as current for " +
-							httpServletRequest.getContextPath() + "," +
-							httpServletRequest.getServerName());
+						httpServletRequest.getContextPath() + "," +
+						httpServletRequest.getServerName());
 				}
 			}
 			else
@@ -178,9 +177,8 @@
 				if (log.isDebugEnabled())
 				{
 					log.debug("could not set Wicket session: key " + sessionKey +
-							" not found in http session for " +
-							httpServletRequest.getContextPath() + "," +
-							httpServletRequest.getServerName());
+						" not found in http session for " + httpServletRequest.getContextPath() +
+						"," + httpServletRequest.getServerName());
 				}
 			}
 		}
@@ -189,13 +187,19 @@
 			if (log.isDebugEnabled())
 			{
 				log.debug("could not set Wicket session: no http session was created yet for " +
-						httpServletRequest.getContextPath() + "," +
-						httpServletRequest.getServerName());
+					httpServletRequest.getContextPath() + "," + httpServletRequest.getServerName());
 			}
 		}
 
-		// go on with processing
-		chain.doFilter(request, response);
+		try
+		{
+			// go on with processing
+			chain.doFilter(request, response);
+		}
+		finally
+		{
+			Session.unset();
+		}
 	}
 
 	/**