Author: ate
Date: Sun Mar 7 23:10:34 2010
New Revision: 920150
URL: http://svn.apache.org/viewvc?rev=920150&view=rev
Log:
Fix for JS2-1119: Impossible to log in using Jetspeed 2 and Tomcat 6.0.24
See: https://issues.apache.org/jira/browse/JS2-1119
Modified:
portals/jetspeed-2/portal/branches/JETSPEED-2.1.4/commons/src/java/org/apache/jetspeed/container/session/PortletApplicationSessionMonitorImpl.java
portals/jetspeed-2/portal/branches/JETSPEED-2.1.4/components/portal/src/java/org/apache/jetspeed/container/session/PortalSessionsManagerImpl.java
portals/jetspeed-2/portal/branches/JETSPEED-2.1.4/jetspeed-api/src/java/org/apache/jetspeed/container/session/PortletApplicationSessionMonitor.java
Modified:
portals/jetspeed-2/portal/branches/JETSPEED-2.1.4/commons/src/java/org/apache/jetspeed/container/session/PortletApplicationSessionMonitorImpl.java
URL:
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-2.1.4/commons/src/java/org/apache/jetspeed/container/session/PortletApplicationSessionMonitorImpl.java?rev=920150&r1=920149&r2=920150&view=diff
==============================================================================
---
portals/jetspeed-2/portal/branches/JETSPEED-2.1.4/commons/src/java/org/apache/jetspeed/container/session/PortletApplicationSessionMonitorImpl.java
(original)
+++
portals/jetspeed-2/portal/branches/JETSPEED-2.1.4/commons/src/java/org/apache/jetspeed/container/session/PortletApplicationSessionMonitorImpl.java
Sun Mar 7 23:10:34 2010
@@ -156,6 +156,17 @@
session = null;
}
+ /* (non-Javadoc)
+ * @see
org.apache.jetspeed.container.session.PortletApplicationSessionMonitor#syncPortalSessionId(org.apache.jetspeed.container.session.PortalSessionMonitor)
+ */
+ public void syncPortalSessionId(PortalSessionMonitor psm)
+ {
+ if (psm != null && psm.getSessionKey() == getPortalSessionKey())
+ {
+ this.portalSessionId = psm.getSessionId();
+ }
+ }
+
private PortalSessionsManager getManager()
{
PortletServices services = JetspeedPortletServices.getSingleton();
Modified:
portals/jetspeed-2/portal/branches/JETSPEED-2.1.4/components/portal/src/java/org/apache/jetspeed/container/session/PortalSessionsManagerImpl.java
URL:
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-2.1.4/components/portal/src/java/org/apache/jetspeed/container/session/PortalSessionsManagerImpl.java?rev=920150&r1=920149&r2=920150&view=diff
==============================================================================
---
portals/jetspeed-2/portal/branches/JETSPEED-2.1.4/components/portal/src/java/org/apache/jetspeed/container/session/PortalSessionsManagerImpl.java
(original)
+++
portals/jetspeed-2/portal/branches/JETSPEED-2.1.4/components/portal/src/java/org/apache/jetspeed/container/session/PortalSessionsManagerImpl.java
Sun Mar 7 23:10:34 2010
@@ -24,6 +24,7 @@
import java.util.Map;
import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpSessionBindingEvent;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -73,13 +74,47 @@
public void portalSessionCreated(HttpSession portalSession)
{
PortalSessionMonitor psm = null;
+ boolean newMonitor = false;
synchronized (this)
{
- psm = new PortalSessionMonitorImpl(++portalSessionKeySequence,
forceInvalidate);
+ psm =
(PortalSessionMonitor)portalSession.getAttribute(PortalSessionMonitor.SESSION_KEY);
+ if (psm != null)
+ {
+ // An existing session is been "recreated", or a new sessionID
has been set
+ // Tomcat 5.5.29+/6.0.21+ has a new feature called
changeSessionIdOnAuthentication, see:
https://issues.apache.org/bugzilla/show_bug.cgi?id=45255
+ // which can cause this
+ if (psm.getSessionId() != portalSession.getId())
+ {
+ // update all sessionID keys and the portal session
registry key
+ PortalSessionRegistry psr =
(PortalSessionRegistry)portalSessionsRegistry.remove(psm.getSessionId());
+ if (psr != null)
+ {
+ // update session and specifically the sessionId in psm
+ psm.valueBound(new
HttpSessionBindingEvent(portalSession, null));
+ Iterator iter =
valuesShallowCopy(psr.sessionMonitors.values()).iterator();
+ while (iter.hasNext())
+ {
+ ((PortletApplicationSessionMonitor)
iter.next()).syncPortalSessionId(psm);
+ }
+ portalSessionsRegistry.put(psm.getSessionId(), psr);
+ }
+ else
+ {
+ psm = null;
+ }
+ }
+ }
+ if (psm == null)
+ {
+ psm = new PortalSessionMonitorImpl(++portalSessionKeySequence,
forceInvalidate);
+ newMonitor = true;
+ }
+ }
+ if (newMonitor)
+ {
+ portalSession.setAttribute(PortalSessionMonitor.SESSION_KEY, psm);
}
-
- portalSession.setAttribute(PortalSessionMonitor.SESSION_KEY, psm);
// register it as if activated
portalSessionDidActivate(psm);
}
Modified:
portals/jetspeed-2/portal/branches/JETSPEED-2.1.4/jetspeed-api/src/java/org/apache/jetspeed/container/session/PortletApplicationSessionMonitor.java
URL:
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-2.1.4/jetspeed-api/src/java/org/apache/jetspeed/container/session/PortletApplicationSessionMonitor.java?rev=920150&r1=920149&r2=920150&view=diff
==============================================================================
---
portals/jetspeed-2/portal/branches/JETSPEED-2.1.4/jetspeed-api/src/java/org/apache/jetspeed/container/session/PortletApplicationSessionMonitor.java
(original)
+++
portals/jetspeed-2/portal/branches/JETSPEED-2.1.4/jetspeed-api/src/java/org/apache/jetspeed/container/session/PortletApplicationSessionMonitor.java
Sun Mar 7 23:10:34 2010
@@ -36,4 +36,5 @@
String getContextPath();
void invalidateSession();
HttpSession getSession();
+ void syncPortalSessionId(PortalSessionMonitor psm);
}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]