Author: cmailleux
Date: Thu Jul 12 18:09:50 2007
New Revision: 17976

URL: https://svndev.jahia.net/websvn/listing.php?sc=3D1&rev=3D17976&repname=
=3Djahia
Log:
Port of commit [17318] Invalidate user session in esi

Modified:
    trunk/core/src/java/org/jahia/bin/JahiaWebAppListener.java
    trunk/core/src/java/org/jahia/engines/logout/Logout_Engine.java

Modified: trunk/core/src/java/org/jahia/bin/JahiaWebAppListener.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/core/src/java/o=
rg/jahia/bin/JahiaWebAppListener.java&rev=3D17976&repname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/core/src/java/org/jahia/bin/JahiaWebAppListener.java (original)
+++ trunk/core/src/java/org/jahia/bin/JahiaWebAppListener.java Thu Jul 12 1=
8:09:50 2007
@@ -85,9 +85,9 @@
             JahiaUser u =3D (JahiaUser) se.getSession().getAttribute(Param=
Bean.SESSION_USER);
             if (u !=3D null) {
                 servReg.getLockService().purgeLockForContext(u.getUserKey(=
));
-            }
-            if(Jahia.getSettings().isEsiCacheActivated()) {
-                servReg.getEsiSOAPInvalidatorService().SOAPInvalidateUserS=
ession(se.getSession().getId(),u);
+                if (Jahia.getSettings().isEsiCacheActivated()) {
+                    servReg.getEsiSOAPInvalidatorService().SOAPInvalidateU=
serSession(se.getSession().getId(), u);
+                }
             }
         }
     }

Modified: trunk/core/src/java/org/jahia/engines/logout/Logout_Engine.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/core/src/java/o=
rg/jahia/engines/logout/Logout_Engine.java&rev=3D17976&repname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/core/src/java/org/jahia/engines/logout/Logout_Engine.java (origin=
al)
+++ trunk/core/src/java/org/jahia/engines/logout/Logout_Engine.java Thu Jul=
 12 18:09:50 2007
@@ -178,13 +178,15 @@
         // if there is no engineparams, it just means that the engine is s=
till set to
         // logout, but in fact the user wants to call "core". This is beca=
use a user
         // logs outs, the page is reloaded but still with engine "logout".
+        final ServicesRegistry servicesRegistry =3D ServicesRegistry.getIn=
stance();
+        final ParamBean bean =3D ((ParamBean) jParams);
         if ((engineParams !=3D null) && (engineParams.equals("logout"))) {
             if (logger.isDebugEnabled())
                 logger.debug("User [" + jParams.getUser().getName() + "] l=
ogged out.");
 =

             // send a new logout event !
             JahiaEvent theEvent =3D new JahiaEvent(this, jParams, jParams.=
getUser());
-            ServicesRegistry.getInstance().getJahiaEventService().fireLogo=
ut(theEvent);
+            servicesRegistry.getJahiaEventService().fireLogout(theEvent);
 =

             logoutPage =3D getLogoutPage(jData);
 =

@@ -196,13 +198,14 @@
             Cookie authCookie =3D new Cookie(settingsBean.getCookieAuthCoo=
kieName(), cookieAuthKey);
             authCookie.setPath(jParams.getContextPath());
             authCookie.setMaxAge(0); // means we want it deleted now !
-            ((ParamBean) jParams).getRealResponse().addCookie(authCookie);
+            bean.getRealResponse().addCookie(authCookie);
             curUser.removeProperty(settingsBean.getCookieAuthUserPropertyN=
ame());
 =

             if (jParams.settings().isEsiCacheActivated()) {
                 //make sure this response is not cached by ESI
                 String noCacheHeader =3D "content=3D\"ESI/1.0\",no-store";
-                ((ParamBean) jParams).getRealResponse().setHeader(JesiCons=
t.SURROGATE_CONTROL_HEADER,noCacheHeader);
+                bean.getRealResponse().setHeader(JesiConst.SURROGATE_CONTR=
OL_HEADER,noCacheHeader);
+                servicesRegistry.getEsiSOAPInvalidatorService().SOAPInvali=
dateUserSession(bean.getSession().getId(), curUser);                =

             }
             //remove any ESI cookies if there is one
             EsiUrlCookieCheckValve.deleteCookie(jParams); //esi=3Don check=
 is done in the method (we also need to delete the TEMPLATE_USERNAME_COOKIE=
) =

@@ -210,7 +213,7 @@
             // if we were in edit mode, let's destroy the cache's entry fo=
r this page and this user.
             if (ProcessingContext.EDIT.equals(jParams.getOperationMode()))=
 {
                 // Get the HTML cache instance
-                HtmlCache htmlCache =3D ServicesRegistry.getInstance().get=
CacheService().getHtmlCacheInstance();
+                HtmlCache htmlCache =3D servicesRegistry.getCacheService()=
.getHtmlCacheInstance();
                 if (htmlCache !=3D null) {
                     // invalidate the user entries
                     htmlCache.invalidateUserEntries(jParams.getUser().getU=
sername());
@@ -231,12 +234,13 @@
         String redirectUrl =3D jParams.settings().getLogoutRedirectUrl();
         if (redirectUrl!=3Dnull) {
             try {
-                ((ParamBean) jParams).getRealResponse().sendRedirect(redir=
ectUrl);
+                bean.getRealResponse().sendRedirect(redirectUrl);
                 if (logger.isDebugEnabled())
                     logger.debug("Logout triggered Http redirection to [" =
+ redirectUrl + "]");
             } catch (IOException e) {
                 throw new JahiaException("Logout redirection failed. Page:=
 " + jParams.getPageID(),
-                        "Error redirecting to ["+ redirectUrl + "] from ["=
+((ParamBean) jParams).getRealRequest().getRequestURL().toString()+"]",
+                        "Error redirecting to ["+ redirectUrl + "] from ["+
+                        bean.getRealRequest().getRequestURL().toString()+"=
]",
                         JahiaException.APPLICATION_ERROR,
                         JahiaException.ERROR_SEVERITY);
             }
@@ -302,7 +306,7 @@
             }
 =

             // change the page
-            ContentPage contentPage =3D ServicesRegistry.getInstance()
+            ContentPage contentPage =3D servicesRegistry
                     .getJahiaPageService().lookupContentPage(logoutPage.ge=
tID(),
                     jParams.getEntryLoadRequest(), true);
             jParams.changePage(contentPage);
@@ -320,7 +324,7 @@
         if (logoutPage.hasActiveEntries()
                 && logoutPage.checkGuestAccess(jParams.getSiteID())) {
             if (jParams instanceof ParamBean) {
-            ParamBean paramBean =3D (ParamBean) jParams;
+            ParamBean paramBean =3D bean;
             paramBean.invalidateSession();
             }
             JahiaData jData2 =3D new JahiaData(jParams, true);
@@ -329,7 +333,7 @@
 =

         } else {
             if (jParams instanceof ParamBean) {
-            ParamBean paramBean =3D (ParamBean) jParams;
+            ParamBean paramBean =3D bean;
             paramBean.invalidateSession();
         }
             jParams.setUserGuest(jParams.getSiteID());

_______________________________________________
cvs_list mailing list
[email protected]
http://lists.jahia.org/cgi-bin/mailman/listinfo/cvs_list

Reply via email to