Author: thomas.heute(a)jboss.com
Date: 2010-04-14 10:04:59 -0400 (Wed, 14 Apr 2010)
New Revision: 2638
Modified:
portal/branches/EPP_5_0_0_CR01_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMOrganizationServiceImpl.java
portal/branches/EPP_5_0_0_CR01_Branch/component/web/src/main/java/org/exoplatform/web/CacheUserProfileFilter.java
Log:
JBEPP-303: GateIn+SSO integration: IdentityException thrown in special case when HTTP
session expire
Modified:
portal/branches/EPP_5_0_0_CR01_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMOrganizationServiceImpl.java
===================================================================
---
portal/branches/EPP_5_0_0_CR01_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMOrganizationServiceImpl.java 2010-04-14
13:06:31 UTC (rev 2637)
+++
portal/branches/EPP_5_0_0_CR01_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMOrganizationServiceImpl.java 2010-04-14
14:04:59 UTC (rev 2638)
@@ -31,6 +31,7 @@
import org.picocontainer.Startable;
import javax.naming.InitialContext;
+import javax.transaction.Status;
import javax.transaction.UserTransaction;
import java.util.LinkedList;
import java.util.concurrent.atomic.AtomicInteger;
@@ -141,11 +142,17 @@
if (configuration.isUseJTA())
{
UserTransaction tx = (UserTransaction)new
InitialContext().lookup("java:comp/UserTransaction");
- tx.begin();
+ if (tx.getStatus() == Status.STATUS_NO_TRANSACTION)
+ {
+ tx.begin();
+ }
}
else
{
- idmService_.getIdentitySession().beginTransaction();
+ if (!idmService_.getIdentitySession().getTransaction().isActive())
+ {
+ idmService_.getIdentitySession().beginTransaction();
+ }
}
}
catch (Exception e)
Modified:
portal/branches/EPP_5_0_0_CR01_Branch/component/web/src/main/java/org/exoplatform/web/CacheUserProfileFilter.java
===================================================================
---
portal/branches/EPP_5_0_0_CR01_Branch/component/web/src/main/java/org/exoplatform/web/CacheUserProfileFilter.java 2010-04-14
13:06:31 UTC (rev 2637)
+++
portal/branches/EPP_5_0_0_CR01_Branch/component/web/src/main/java/org/exoplatform/web/CacheUserProfileFilter.java 2010-04-14
14:04:59 UTC (rev 2638)
@@ -19,6 +19,8 @@
package org.exoplatform.web;
+import org.exoplatform.container.component.ComponentRequestLifecycle;
+import org.exoplatform.container.component.RequestLifeCycle;
import org.exoplatform.container.web.AbstractFilter;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -59,7 +61,9 @@
OrganizationService orgService =
(OrganizationService)getContainer().getComponentInstanceOfType(OrganizationService.class);
+ begin(orgService);
User user =
orgService.getUserHandler().findUserByName(state.getIdentity().getUserId());
+ end(orgService);
state.setAttribute(USER_PROFILE, user);
}
@@ -77,4 +81,20 @@
public void destroy()
{
}
+
+ public void begin(OrganizationService orgService) throws Exception
+ {
+ if (orgService instanceof ComponentRequestLifecycle)
+ {
+ RequestLifeCycle.begin((ComponentRequestLifecycle)orgService);
+ }
+ }
+
+ public void end(OrganizationService orgService) throws Exception
+ {
+ if (orgService instanceof ComponentRequestLifecycle)
+ {
+ RequestLifeCycle.end();
+ }
+ }
}
Show replies by date