Author: mstruk
Date: 2011-03-11 10:48:16 -0500 (Fri, 11 Mar 2011)
New Revision: 6010
Added:
components/wci/trunk/wci/src/main/java/org/gatein/wci/ServletContainerVisitor.java
Modified:
components/wci/trunk/
components/wci/trunk/jboss/jboss6/src/main/java/org/gatein/wci/jboss/JB6ContainerServlet.java
components/wci/trunk/jboss/jboss6/src/main/java/org/gatein/wci/jboss/JB6ServletContainerContext.java
components/wci/trunk/jboss/jboss6/src/main/java/org/gatein/wci/jboss/JB6WebAppContext.java
components/wci/trunk/jetty/src/main/java/org/gatein/wci/jetty/Jetty6WebAppContext.java
components/wci/trunk/test/core/src/main/java/org/gatein/wci/container/WebAppContextImpl.java
components/wci/trunk/tomcat/tomcat6/src/main/java/org/gatein/wci/tomcat/TC6ContainerServlet.java
components/wci/trunk/tomcat/tomcat6/src/main/java/org/gatein/wci/tomcat/TC6ServletContainerContext.java
components/wci/trunk/tomcat/tomcat6/src/main/java/org/gatein/wci/tomcat/TC6WebAppContext.java
components/wci/trunk/tomcat/tomcat7/src/main/java/org/gatein/wci/tomcat/TC7ContainerServlet.java
components/wci/trunk/tomcat/tomcat7/src/main/java/org/gatein/wci/tomcat/TC7ServletContainerContext.java
components/wci/trunk/tomcat/tomcat7/src/main/java/org/gatein/wci/tomcat/TC7WebAppContext.java
components/wci/trunk/wci/src/main/java/org/gatein/wci/ServletContainer.java
components/wci/trunk/wci/src/main/java/org/gatein/wci/WebApp.java
components/wci/trunk/wci/src/main/java/org/gatein/wci/authentication/GenericAuthentication.java
components/wci/trunk/wci/src/main/java/org/gatein/wci/impl/DefaultServletContainer.java
components/wci/trunk/wci/src/main/java/org/gatein/wci/impl/generic/GenericWebAppContext.java
components/wci/trunk/wci/src/main/java/org/gatein/wci/spi/WebAppContext.java
Log:
GTNPORTAL-1706 session cleanup after logout
Property changes on: components/wci/trunk
___________________________________________________________________
Added: svn:mergeinfo
+ /components/wci/branches/logout:5894-6009
Modified:
components/wci/trunk/jboss/jboss6/src/main/java/org/gatein/wci/jboss/JB6ContainerServlet.java
===================================================================
---
components/wci/trunk/jboss/jboss6/src/main/java/org/gatein/wci/jboss/JB6ContainerServlet.java 2011-03-11
14:27:41 UTC (rev 6009)
+++
components/wci/trunk/jboss/jboss6/src/main/java/org/gatein/wci/jboss/JB6ContainerServlet.java 2011-03-11
15:48:16 UTC (rev 6010)
@@ -29,6 +29,8 @@
import org.apache.catalina.ContainerServlet;
import org.apache.catalina.Engine;
import org.apache.catalina.Wrapper;
+import org.gatein.common.logging.Logger;
+import org.gatein.common.logging.LoggerFactory;
/**
* @author <a href="mailto:mwringe@redhat.com">Matt Wringe</a>
@@ -36,6 +38,11 @@
*/
public class JB6ContainerServlet extends HttpServlet implements ContainerServlet
{
+ private static final Logger log = LoggerFactory.getLogger(JB6ContainerServlet.class);
+
+ /** Servlet context init parameter name that can be used to turn off cross-context
logout */
+ private static final String CROSS_CONTEXT_LOGOUT_KEY =
"org.gatein.wci.cross_context_logout";
+
/** . */
private Wrapper wrapper;
@@ -107,6 +114,7 @@
{
Engine engine = (Engine) container;
containerContext = new JB6ServletContainerContext(engine);
+ containerContext.setCrossContextLogout(getCrossContextLogoutConfig());
containerContext.start();
break;
}
@@ -123,4 +131,21 @@
containerContext = null;
}
}
+
+ private boolean getCrossContextLogoutConfig()
+ {
+ String val = getServletContext().getInitParameter(CROSS_CONTEXT_LOGOUT_KEY);
+ if (val == null || Boolean.valueOf(val))
+ {
+ return true;
+ }
+
+ if (!"false".equalsIgnoreCase(val))
+ {
+ log.warn("Context init param " + CROSS_CONTEXT_LOGOUT_KEY + "
value is invalid: " + val + " - falling back to: false");
+ }
+
+ log.info("Cross-context session invalidation on logout disabled");
+ return false;
+ }
}
Modified:
components/wci/trunk/jboss/jboss6/src/main/java/org/gatein/wci/jboss/JB6ServletContainerContext.java
===================================================================
---
components/wci/trunk/jboss/jboss6/src/main/java/org/gatein/wci/jboss/JB6ServletContainerContext.java 2011-03-11
14:27:41 UTC (rev 6009)
+++
components/wci/trunk/jboss/jboss6/src/main/java/org/gatein/wci/jboss/JB6ServletContainerContext.java 2011-03-11
15:48:16 UTC (rev 6010)
@@ -35,6 +35,8 @@
import org.gatein.common.logging.Logger;
import org.gatein.common.logging.LoggerFactory;
import org.gatein.wci.RequestDispatchCallback;
+import org.gatein.wci.ServletContainerVisitor;
+import org.gatein.wci.WebApp;
import org.gatein.wci.authentication.GenericAuthentication;
import org.gatein.wci.authentication.TicketService;
import org.gatein.wci.command.CommandDispatcher;
@@ -46,6 +48,7 @@
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.HashSet;
import java.util.Set;
@@ -75,8 +78,8 @@
/** . */
private Registration registration;
- /** . */
- private GenericAuthentication authentication = new GenericAuthentication();
+ /** Perform cross-context session invalidation on logout, or not */
+ private boolean crossContextLogout = true;
public JB6ServletContainerContext(Engine engine)
{
@@ -99,6 +102,11 @@
this.registration = null;
}
+ public void setCrossContextLogout(boolean val)
+ {
+ crossContextLogout = val;
+ }
+
public void login(HttpServletRequest request, HttpServletResponse response,
Credentials credentials, long validityMillis) throws ServletException, IOException
{
login(request, response, credentials, validityMillis, null);
@@ -133,10 +141,26 @@
}
}
+
public void logout(HttpServletRequest request, HttpServletResponse response) throws
ServletException
{
+ HttpSession sess = request.getSession(false);
request.logout();
- request.getSession().invalidate();
+
+ if (sess == null)
+ return;
+
+ if (!crossContextLogout)
+ return;
+
+ final String sessId = sess.getId();
+ DefaultServletContainerFactory.getInstance().getServletContainer().visit(new
ServletContainerVisitor()
+ {
+ public void accept(WebApp webApp)
+ {
+ webApp.invalidateSession(sessId);
+ }
+ });
}
public String getContainerInfo()
Modified:
components/wci/trunk/jboss/jboss6/src/main/java/org/gatein/wci/jboss/JB6WebAppContext.java
===================================================================
---
components/wci/trunk/jboss/jboss6/src/main/java/org/gatein/wci/jboss/JB6WebAppContext.java 2011-03-11
14:27:41 UTC (rev 6009)
+++
components/wci/trunk/jboss/jboss6/src/main/java/org/gatein/wci/jboss/JB6WebAppContext.java 2011-03-11
15:48:16 UTC (rev 6010)
@@ -28,6 +28,8 @@
import javax.servlet.ServletContext;
import org.apache.catalina.Context;
+import org.apache.catalina.Manager;
+import org.apache.catalina.Session;
import org.apache.catalina.Wrapper;
import org.gatein.wci.command.CommandServlet;
import org.gatein.wci.spi.WebAppContext;
@@ -125,4 +127,25 @@
{
return false;
}
+
+ public boolean invalidateSession(String sessId)
+ {
+ Manager mgr = context.getManager();
+ if (mgr != null)
+ {
+ try
+ {
+ Session sess = mgr.findSession(sessId);
+ if (sess != null)
+ {
+ sess.expire();
+ return true;
+ }
+ }
+ catch (IOException ignored)
+ {
+ }
+ }
+ return false;
+ }
}
Modified:
components/wci/trunk/jetty/src/main/java/org/gatein/wci/jetty/Jetty6WebAppContext.java
===================================================================
---
components/wci/trunk/jetty/src/main/java/org/gatein/wci/jetty/Jetty6WebAppContext.java 2011-03-11
14:27:41 UTC (rev 6009)
+++
components/wci/trunk/jetty/src/main/java/org/gatein/wci/jetty/Jetty6WebAppContext.java 2011-03-11
15:48:16 UTC (rev 6010)
@@ -119,4 +119,9 @@
{
return false;
}
+
+ public boolean invalidateSession(String sessId)
+ {
+ return false;
+ }
}
Modified:
components/wci/trunk/test/core/src/main/java/org/gatein/wci/container/WebAppContextImpl.java
===================================================================
---
components/wci/trunk/test/core/src/main/java/org/gatein/wci/container/WebAppContextImpl.java 2011-03-11
14:27:41 UTC (rev 6009)
+++
components/wci/trunk/test/core/src/main/java/org/gatein/wci/container/WebAppContextImpl.java 2011-03-11
15:48:16 UTC (rev 6010)
@@ -76,4 +76,9 @@
{
throw new UnsupportedOperationException();
}
+
+ public boolean invalidateSession(String sessId)
+ {
+ return false;
+ }
}
Modified:
components/wci/trunk/tomcat/tomcat6/src/main/java/org/gatein/wci/tomcat/TC6ContainerServlet.java
===================================================================
---
components/wci/trunk/tomcat/tomcat6/src/main/java/org/gatein/wci/tomcat/TC6ContainerServlet.java 2011-03-11
14:27:41 UTC (rev 6009)
+++
components/wci/trunk/tomcat/tomcat6/src/main/java/org/gatein/wci/tomcat/TC6ContainerServlet.java 2011-03-11
15:48:16 UTC (rev 6010)
@@ -26,6 +26,8 @@
import org.apache.catalina.Wrapper;
import org.apache.catalina.Container;
import org.apache.catalina.Engine;
+import org.gatein.common.logging.Logger;
+import org.gatein.common.logging.LoggerFactory;
import javax.servlet.http.HttpServlet;
import javax.servlet.ServletException;
@@ -36,7 +38,11 @@
*/
public class TC6ContainerServlet extends HttpServlet implements ContainerServlet
{
+ private static final Logger log = LoggerFactory.getLogger(TC6ContainerServlet.class);
+ /** Servlet context init parameter name that can be used to turn off cross-context
logout */
+ private static final String CROSS_CONTEXT_LOGOUT_KEY =
"org.gatein.wci.cross_context_logout";
+
/** . */
private Wrapper wrapper;
@@ -108,6 +114,7 @@
{
Engine engine = (Engine)container;
containerContext = new TC6ServletContainerContext(engine);
+ containerContext.setCrossContextLogout(getCrossContextLogoutConfig());
containerContext.start();
break;
}
@@ -124,4 +131,16 @@
containerContext = null;
}
}
+
+ private boolean getCrossContextLogoutConfig() {
+ String val = getServletContext().getInitParameter(CROSS_CONTEXT_LOGOUT_KEY);
+ if (val == null || Boolean.valueOf(val))
+ return true;
+
+ if (!"false".equalsIgnoreCase(val))
+ log.warn("Context init param " + CROSS_CONTEXT_LOGOUT_KEY + "
value is invalid: " + val + " - falling back to: false");
+
+ log.info("Cross-context session invalidation on logout disabled");
+ return false;
+ }
}
Modified:
components/wci/trunk/tomcat/tomcat6/src/main/java/org/gatein/wci/tomcat/TC6ServletContainerContext.java
===================================================================
---
components/wci/trunk/tomcat/tomcat6/src/main/java/org/gatein/wci/tomcat/TC6ServletContainerContext.java 2011-03-11
14:27:41 UTC (rev 6009)
+++
components/wci/trunk/tomcat/tomcat6/src/main/java/org/gatein/wci/tomcat/TC6ServletContainerContext.java 2011-03-11
15:48:16 UTC (rev 6010)
@@ -34,6 +34,9 @@
import org.gatein.common.logging.Logger;
import org.gatein.common.logging.LoggerFactory;
import org.gatein.wci.RequestDispatchCallback;
+import org.gatein.wci.ServletContainerVisitor;
+import org.gatein.wci.WebApp;
+
import org.gatein.wci.authentication.GenericAuthentication;
import org.gatein.wci.command.CommandDispatcher;
import org.gatein.wci.impl.DefaultServletContainerFactory;
@@ -45,6 +48,7 @@
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.HashSet;
import java.util.Set;
@@ -74,6 +78,9 @@
/** . */
private Registration registration;
+ /** Perform cross-context session invalidation on logout, or not */
+ private boolean crossContextLogout = true;
+
/** . */
private GenericAuthentication authentication = new GenericAuthentication();
@@ -102,6 +109,11 @@
this.registration = null;
}
+ public void setCrossContextLogout(boolean val)
+ {
+ crossContextLogout = val;
+ }
+
public void login(HttpServletRequest request, HttpServletResponse response,
Credentials credentials, long validityMillis) throws IOException
{
authentication.login(credentials, request, response, validityMillis);
@@ -112,9 +124,26 @@
authentication.login(credentials, request, response, validityMillis, initialURI);
}
- public void logout(HttpServletRequest request, HttpServletResponse response) throws
ServletException
+ public void logout(HttpServletRequest request, HttpServletResponse response)
{
- authentication.logout(request, response);
+ HttpSession sess = request.getSession(false);
+
+ if (sess == null)
+ return;
+
+ sess.invalidate();
+
+ if (!crossContextLogout)
+ return;
+
+ final String sessId = sess.getId();
+ DefaultServletContainerFactory.getInstance().getServletContainer().visit(new
ServletContainerVisitor()
+ {
+ public void accept(WebApp webApp)
+ {
+ webApp.invalidateSession(sessId);
+ }
+ });
}
public String getContainerInfo()
Modified:
components/wci/trunk/tomcat/tomcat6/src/main/java/org/gatein/wci/tomcat/TC6WebAppContext.java
===================================================================
---
components/wci/trunk/tomcat/tomcat6/src/main/java/org/gatein/wci/tomcat/TC6WebAppContext.java 2011-03-11
14:27:41 UTC (rev 6009)
+++
components/wci/trunk/tomcat/tomcat6/src/main/java/org/gatein/wci/tomcat/TC6WebAppContext.java 2011-03-11
15:48:16 UTC (rev 6010)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.gatein.wci.tomcat;
+import org.apache.catalina.Manager;
+import org.apache.catalina.Session;
import org.w3c.dom.Document;
import org.apache.catalina.Context;
import org.apache.catalina.Wrapper;
@@ -124,4 +126,25 @@
{
return false;
}
+
+ public boolean invalidateSession(String sessId)
+ {
+ Manager mgr = context.getManager();
+ if (mgr != null)
+ {
+ try
+ {
+ Session sess = mgr.findSession(sessId);
+ if (sess != null)
+ {
+ sess.expire();
+ return true;
+ }
+ }
+ catch (IOException ignored)
+ {
+ }
+ }
+ return false;
+ }
}
Modified:
components/wci/trunk/tomcat/tomcat7/src/main/java/org/gatein/wci/tomcat/TC7ContainerServlet.java
===================================================================
---
components/wci/trunk/tomcat/tomcat7/src/main/java/org/gatein/wci/tomcat/TC7ContainerServlet.java 2011-03-11
14:27:41 UTC (rev 6009)
+++
components/wci/trunk/tomcat/tomcat7/src/main/java/org/gatein/wci/tomcat/TC7ContainerServlet.java 2011-03-11
15:48:16 UTC (rev 6010)
@@ -26,6 +26,8 @@
import org.apache.catalina.ContainerServlet;
import org.apache.catalina.Engine;
import org.apache.catalina.Wrapper;
+import org.gatein.common.logging.Logger;
+import org.gatein.common.logging.LoggerFactory;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
@@ -36,7 +38,11 @@
*/
public class TC7ContainerServlet extends HttpServlet implements ContainerServlet
{
+ private static final Logger log = LoggerFactory.getLogger(TC7ContainerServlet.class);
+ /** Servlet context init parameter name that can be used to turn off cross-context
logout */
+ private static final String CROSS_CONTEXT_LOGOUT_KEY =
"org.gatein.wci.cross_context_logout";
+
/** . */
private Wrapper wrapper;
@@ -108,6 +114,7 @@
{
Engine engine = (Engine)container;
containerContext = new TC7ServletContainerContext(engine);
+ containerContext.setCrossContextLogout(getCrossContextLogoutConfig());
containerContext.start();
break;
}
@@ -124,4 +131,16 @@
containerContext = null;
}
}
+
+ private boolean getCrossContextLogoutConfig() {
+ String val = getServletContext().getInitParameter(CROSS_CONTEXT_LOGOUT_KEY);
+ if (val == null || Boolean.valueOf(val))
+ return true;
+
+ if (!"false".equalsIgnoreCase(val))
+ log.warn("Context init param " + CROSS_CONTEXT_LOGOUT_KEY + "
value is invalid: " + val + " - falling back to: false");
+
+ log.info("Cross-context session invalidation on logout disabled");
+ return false;
+ }
}
Modified:
components/wci/trunk/tomcat/tomcat7/src/main/java/org/gatein/wci/tomcat/TC7ServletContainerContext.java
===================================================================
---
components/wci/trunk/tomcat/tomcat7/src/main/java/org/gatein/wci/tomcat/TC7ServletContainerContext.java 2011-03-11
14:27:41 UTC (rev 6009)
+++
components/wci/trunk/tomcat/tomcat7/src/main/java/org/gatein/wci/tomcat/TC7ServletContainerContext.java 2011-03-11
15:48:16 UTC (rev 6010)
@@ -36,7 +36,11 @@
import org.gatein.common.logging.Logger;
import org.gatein.common.logging.LoggerFactory;
import org.gatein.wci.RequestDispatchCallback;
+import org.gatein.wci.ServletContainerVisitor;
+import org.gatein.wci.WebApp;
+
import org.gatein.wci.authentication.GenericAuthentication;
+
import org.gatein.wci.authentication.TicketService;
import org.gatein.wci.command.CommandDispatcher;
import org.gatein.wci.impl.DefaultServletContainerFactory;
@@ -47,6 +51,7 @@
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.HashSet;
import java.util.Set;
@@ -76,6 +81,9 @@
/** . */
private Registration registration;
+ /** Perform cross-context session invalidation on logout, or not */
+ private boolean crossContextLogout = true;
+
public TC7ServletContainerContext(Engine engine)
{
this.engine = engine;
@@ -101,6 +109,11 @@
this.registration = null;
}
+ public void setCrossContextLogout(boolean val)
+ {
+ crossContextLogout = val;
+ }
+
public void login(HttpServletRequest request, HttpServletResponse response,
Credentials credentials, long validityMillis) throws ServletException, IOException
{
login(request, response, credentials, validityMillis, null);
@@ -135,8 +148,23 @@
public void logout(HttpServletRequest request, HttpServletResponse response) throws
ServletException
{
+ HttpSession sess = request.getSession(false);
request.logout();
- request.getSession().invalidate();
+
+ if (sess == null)
+ return;
+
+ if (!crossContextLogout)
+ return;
+
+ final String sessId = sess.getId();
+ DefaultServletContainerFactory.getInstance().getServletContainer().visit(new
ServletContainerVisitor()
+ {
+ public void accept(WebApp webApp)
+ {
+ webApp.invalidateSession(sessId);
+ }
+ });
}
public String getContainerInfo()
Modified:
components/wci/trunk/tomcat/tomcat7/src/main/java/org/gatein/wci/tomcat/TC7WebAppContext.java
===================================================================
---
components/wci/trunk/tomcat/tomcat7/src/main/java/org/gatein/wci/tomcat/TC7WebAppContext.java 2011-03-11
14:27:41 UTC (rev 6009)
+++
components/wci/trunk/tomcat/tomcat7/src/main/java/org/gatein/wci/tomcat/TC7WebAppContext.java 2011-03-11
15:48:16 UTC (rev 6010)
@@ -23,6 +23,8 @@
package org.gatein.wci.tomcat;
import org.apache.catalina.Context;
+import org.apache.catalina.Manager;
+import org.apache.catalina.Session;
import org.apache.catalina.Wrapper;
import org.gatein.wci.command.CommandServlet;
import org.gatein.wci.spi.WebAppContext;
@@ -124,4 +126,25 @@
{
return false;
}
+
+ public boolean invalidateSession(String sessId)
+ {
+ Manager mgr = context.getManager();
+ if (mgr != null)
+ {
+ try
+ {
+ Session sess = mgr.findSession(sessId);
+ if (sess != null)
+ {
+ sess.expire();
+ return true;
+ }
+ }
+ catch (IOException ignored)
+ {
+ }
+ }
+ return false;
+ }
}
Modified: components/wci/trunk/wci/src/main/java/org/gatein/wci/ServletContainer.java
===================================================================
--- components/wci/trunk/wci/src/main/java/org/gatein/wci/ServletContainer.java 2011-03-11
14:27:41 UTC (rev 6009)
+++ components/wci/trunk/wci/src/main/java/org/gatein/wci/ServletContainer.java 2011-03-11
15:48:16 UTC (rev 6010)
@@ -145,4 +145,11 @@
* @return the string containing at least name and version number
*/
public String getContainerInfo();
+
+ /**
+ * Visit the registered WebApps
+ *
+ * @param visitor ServletContainerVisitor instance
+ */
+ void visit(ServletContainerVisitor visitor);
}
Added: components/wci/trunk/wci/src/main/java/org/gatein/wci/ServletContainerVisitor.java
===================================================================
--- components/wci/trunk/wci/src/main/java/org/gatein/wci/ServletContainerVisitor.java
(rev 0)
+++
components/wci/trunk/wci/src/main/java/org/gatein/wci/ServletContainerVisitor.java 2011-03-11
15:48:16 UTC (rev 6010)
@@ -0,0 +1,14 @@
+package org.gatein.wci;
+
+/**
+ * @author <a href="mailto:mstrukel@redhat.com">Marko Strukelj</a>
+ */
+public interface ServletContainerVisitor
+{
+ /**
+ * During visitation get reference to current WebApp
+ *
+ * @param webApp Currently visited WebApp
+ */
+ public void accept(WebApp webApp);
+}
Modified: components/wci/trunk/wci/src/main/java/org/gatein/wci/WebApp.java
===================================================================
--- components/wci/trunk/wci/src/main/java/org/gatein/wci/WebApp.java 2011-03-11 14:27:41
UTC (rev 6009)
+++ components/wci/trunk/wci/src/main/java/org/gatein/wci/WebApp.java 2011-03-11 15:48:16
UTC (rev 6010)
@@ -72,4 +72,12 @@
* @throws IOException if the file cannot be created
*/
boolean importFile(String parentDirRelativePath, String name, InputStream source,
boolean overwrite) throws IOException;
+
+ /**
+ * Invalidate session for the specified id.
+ *
+ * @param sessId Session id
+ * @return true if session was found, false otherwise
+ */
+ public boolean invalidateSession(String sessId);
}
Modified:
components/wci/trunk/wci/src/main/java/org/gatein/wci/authentication/GenericAuthentication.java
===================================================================
---
components/wci/trunk/wci/src/main/java/org/gatein/wci/authentication/GenericAuthentication.java 2011-03-11
14:27:41 UTC (rev 6009)
+++
components/wci/trunk/wci/src/main/java/org/gatein/wci/authentication/GenericAuthentication.java 2011-03-11
15:48:16 UTC (rev 6010)
@@ -19,8 +19,6 @@
package org.gatein.wci.authentication;
-import org.gatein.wci.impl.DefaultServletContainer;
-import org.gatein.wci.impl.DefaultServletContainerFactory;
import org.gatein.wci.security.Credentials;
import javax.servlet.http.HttpServletRequest;
Modified:
components/wci/trunk/wci/src/main/java/org/gatein/wci/impl/DefaultServletContainer.java
===================================================================
---
components/wci/trunk/wci/src/main/java/org/gatein/wci/impl/DefaultServletContainer.java 2011-03-11
14:27:41 UTC (rev 6009)
+++
components/wci/trunk/wci/src/main/java/org/gatein/wci/impl/DefaultServletContainer.java 2011-03-11
15:48:16 UTC (rev 6010)
@@ -22,6 +22,7 @@
******************************************************************************/
package org.gatein.wci.impl;
+import org.gatein.wci.ServletContainerVisitor;
import org.gatein.wci.authentication.AuthenticationEvent;
import org.gatein.wci.authentication.AuthenticationListener;
import org.gatein.wci.security.Credentials;
@@ -270,6 +271,17 @@
return registration.context.include(targetServletContext, request, response,
callback, handback);
}
+ public void visit(ServletContainerVisitor visitor)
+ {
+ synchronized (lock)
+ {
+ for (WebApp webApp: webAppMap.values())
+ {
+ visitor.accept(webApp);
+ }
+ }
+ }
+
public static enum EventType {
LOGIN, LOGOUT
}
@@ -433,5 +445,10 @@
{
return context.importFile(parentDirRelativePath, name, source, overwrite);
}
+
+ public boolean invalidateSession(String sessId)
+ {
+ return context.invalidateSession(sessId);
+ }
}
}
\ No newline at end of file
Modified:
components/wci/trunk/wci/src/main/java/org/gatein/wci/impl/generic/GenericWebAppContext.java
===================================================================
---
components/wci/trunk/wci/src/main/java/org/gatein/wci/impl/generic/GenericWebAppContext.java 2011-03-11
14:27:41 UTC (rev 6009)
+++
components/wci/trunk/wci/src/main/java/org/gatein/wci/impl/generic/GenericWebAppContext.java 2011-03-11
15:48:16 UTC (rev 6010)
@@ -78,4 +78,9 @@
{
return false;
}
+
+ public boolean invalidateSession(String sessId)
+ {
+ return false;
+ }
}
\ No newline at end of file
Modified: components/wci/trunk/wci/src/main/java/org/gatein/wci/spi/WebAppContext.java
===================================================================
---
components/wci/trunk/wci/src/main/java/org/gatein/wci/spi/WebAppContext.java 2011-03-11
14:27:41 UTC (rev 6009)
+++
components/wci/trunk/wci/src/main/java/org/gatein/wci/spi/WebAppContext.java 2011-03-11
15:48:16 UTC (rev 6010)
@@ -86,4 +86,12 @@
* @throws java.io.IOException if the file cannot be created
*/
boolean importFile(String parentDirRelativePath, String name, InputStream source,
boolean overwrite) throws IOException;
+
+ /**
+ * Invalidate session for the specified id.
+ *
+ * @param sessId Session id
+ * @return true if session was found, false otherwise
+ */
+ boolean invalidateSession(String sessId);
}