Author: ivaynberg
Date: Sun Apr 26 05:33:56 2009
New Revision: 768656

URL: http://svn.apache.org/viewvc?rev=768656&view=rev
Log:
fix for WICKET-2180 WicketSessionFilter assumes that the WicketFilter has 
already been inited
Issue: WICKET-2180

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

Modified: 
wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/servlet/WicketSessionFilter.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/servlet/WicketSessionFilter.java?rev=768656&r1=768655&r2=768656&view=diff
==============================================================================
--- 
wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/servlet/WicketSessionFilter.java
 (original)
+++ 
wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/servlet/WicketSessionFilter.java
 Sun Apr 26 05:33:56 2009
@@ -133,19 +133,8 @@
                                        getClass().getName());
                }
 
-               if (log.isDebugEnabled())
-               {
-                       log.debug("filterName/ application key set to " + 
filterName);
-               }
-
-               WebApplication application = 
(WebApplication)Application.get(filterName);
-               sessionKey = application.getSessionAttributePrefix(null, 
filterName) +
-                       Session.SESSION_ATTRIBUTE_NAME;
+               log.debug("filterName/ application key set to {}", filterName);
 
-               if (log.isDebugEnabled())
-               {
-                       log.debug("will use " + sessionKey + " as the session 
key to get the Wicket session");
-               }
        }
 
        /**
@@ -159,6 +148,15 @@
                HttpSession httpSession = httpServletRequest.getSession(false);
                if (httpSession != null)
                {
+                       if (sessionKey == null)
+                       {
+                               WebApplication application = 
(WebApplication)Application.get(filterName);
+                               sessionKey = 
application.getSessionAttributePrefix(null, filterName) +
+                                       Session.SESSION_ATTRIBUTE_NAME;
+
+                               log.debug("will use {} as the session key to 
get the Wicket session", sessionKey);
+                       }
+
                        Session session = 
(Session)httpSession.getAttribute(sessionKey);
                        if (session != null)
                        {
@@ -184,11 +182,8 @@
                }
                else
                {
-                       if (log.isDebugEnabled())
-                       {
-                               log.debug("could not set Wicket session: no 
http session was created yet for " +
-                                       httpServletRequest.getContextPath() + 
"," + httpServletRequest.getServerName());
-                       }
+                       log.debug("could not set Wicket session: no http 
session was created yet for {},{}",
+                               httpServletRequest.getContextPath(), 
httpServletRequest.getServerName());
                }
 
                try


Reply via email to