Author: ate
Date: Sun Mar 7 22:59:47 2010
New Revision: 920148
URL: http://svn.apache.org/viewvc?rev=920148&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/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/session/PortalSessionsManagerImpl.java
portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/container/session/PortletApplicationSessionMonitor.java
portals/jetspeed-2/portal/trunk/jetspeed-commons/src/main/java/org/apache/jetspeed/container/session/PortletApplicationSessionMonitorImpl.java
Modified:
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/session/PortalSessionsManagerImpl.java
URL:
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/session/PortalSessionsManagerImpl.java?rev=920148&r1=920147&r2=920148&view=diff
==============================================================================
---
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/session/PortalSessionsManagerImpl.java
(original)
+++
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/session/PortalSessionsManagerImpl.java
Sun Mar 7 22:59:47 2010
@@ -73,13 +73,46 @@
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 =
portalSessionsRegistry.remove(psm.getSessionId());
+ if (psr != null)
+ {
+ // update session and specifically the sessionId in psm
+ psm.valueBound(new
HttpSessionBindingEvent(portalSession, null));
+ for (PortletApplicationSessionMonitor pasm :
valuesShallowCopy(psr.sessionMonitors.values()))
+ {
+ pasm.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/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/container/session/PortletApplicationSessionMonitor.java
URL:
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/container/session/PortletApplicationSessionMonitor.java?rev=920148&r1=920147&r2=920148&view=diff
==============================================================================
---
portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/container/session/PortletApplicationSessionMonitor.java
(original)
+++
portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/container/session/PortletApplicationSessionMonitor.java
Sun Mar 7 22:59:47 2010
@@ -36,4 +36,5 @@
String getContextPath();
void invalidateSession();
HttpSession getSession();
+ void syncPortalSessionId(PortalSessionMonitor psm);
}
\ No newline at end of file
Modified:
portals/jetspeed-2/portal/trunk/jetspeed-commons/src/main/java/org/apache/jetspeed/container/session/PortletApplicationSessionMonitorImpl.java
URL:
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-commons/src/main/java/org/apache/jetspeed/container/session/PortletApplicationSessionMonitorImpl.java?rev=920148&r1=920147&r2=920148&view=diff
==============================================================================
---
portals/jetspeed-2/portal/trunk/jetspeed-commons/src/main/java/org/apache/jetspeed/container/session/PortletApplicationSessionMonitorImpl.java
(original)
+++
portals/jetspeed-2/portal/trunk/jetspeed-commons/src/main/java/org/apache/jetspeed/container/session/PortletApplicationSessionMonitorImpl.java
Sun Mar 7 22:59:47 2010
@@ -156,6 +156,17 @@
session = null;
}
+ /* (non-Javadoc)
+ * @see
org.apache.jetspeed.container.session.PortletApplicationSessionMonitor#portalSessionUpdated(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();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]