Author: ndkhoiits
Date: 2010-10-26 23:16:50 -0400 (Tue, 26 Oct 2010)
New Revision: 4848
Modified:
portal/branches/branch-GTNPORTAL-1592/component/web/api/src/main/java/org/exoplatform/web/GenericHttpListener.java
portal/branches/branch-GTNPORTAL-1592/examples/portal/war/src/main/webapp/WEB-INF/web.xml
portal/branches/branch-GTNPORTAL-1592/web/portal/src/main/webapp/WEB-INF/web.xml
Log:
GTNPORTAL-1345 Avoid NPE when a portal container has been disabled
Modified:
portal/branches/branch-GTNPORTAL-1592/component/web/api/src/main/java/org/exoplatform/web/GenericHttpListener.java
===================================================================
---
portal/branches/branch-GTNPORTAL-1592/component/web/api/src/main/java/org/exoplatform/web/GenericHttpListener.java 2010-10-26
14:34:50 UTC (rev 4847)
+++
portal/branches/branch-GTNPORTAL-1592/component/web/api/src/main/java/org/exoplatform/web/GenericHttpListener.java 2010-10-27
03:16:50 UTC (rev 4848)
@@ -19,6 +19,7 @@
package org.exoplatform.web;
+import org.exoplatform.commons.utils.PropertyManager;
import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.container.PortalContainer;
@@ -140,7 +141,19 @@
PortalContainer.setInstance(portalContainer);
hasBeenSet = true;
}
- broadcast(portalContainer, CONTEXT_DESTROYED, event);
+ final String ctxName = event.getServletContext().getServletContextName();
+ if (!PortalContainer.isPortalContainerNameDisabled(ctxName) &&
portalContainer instanceof PortalContainer)
+ {
+ // The portal container corresponding to the current servlet context could be
found
+ broadcast(portalContainer, CONTEXT_DESTROYED, event);
+ }
+ else if (PropertyManager.isDevelopping())
+ {
+ log.info("The portal environment could not be set for the webapp
'" + ctxName
+ + "' because this servlet context has not been defined as a
"
+ + "dependency of any portal container or it is a disabled
portal"
+ + " container, the contextDestroyed event will be ignored");
+ }
}
catch (Exception ex)
{
Modified:
portal/branches/branch-GTNPORTAL-1592/examples/portal/war/src/main/webapp/WEB-INF/web.xml
===================================================================
---
portal/branches/branch-GTNPORTAL-1592/examples/portal/war/src/main/webapp/WEB-INF/web.xml 2010-10-26
14:34:50 UTC (rev 4847)
+++
portal/branches/branch-GTNPORTAL-1592/examples/portal/war/src/main/webapp/WEB-INF/web.xml 2010-10-27
03:16:50 UTC (rev 4848)
@@ -73,6 +73,16 @@
<filter-name>CacheUserProfileFilter</filter-name>
<filter-class>org.exoplatform.web.CacheUserProfileFilter</filter-class>
</filter>
+
+ <filter>
+ <filter-name>PortalContainerFilter</filter-name>
+
<filter-class>org.exoplatform.container.web.PortalContainerFilter</filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>PortalContainerFilter</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
<filter-mapping>
<filter-name>GenericFilter</filter-name>
Modified:
portal/branches/branch-GTNPORTAL-1592/web/portal/src/main/webapp/WEB-INF/web.xml
===================================================================
---
portal/branches/branch-GTNPORTAL-1592/web/portal/src/main/webapp/WEB-INF/web.xml 2010-10-26
14:34:50 UTC (rev 4847)
+++
portal/branches/branch-GTNPORTAL-1592/web/portal/src/main/webapp/WEB-INF/web.xml 2010-10-27
03:16:50 UTC (rev 4848)
@@ -94,6 +94,16 @@
<filter-name>ClusteredSSOFilter</filter-name>
<filter-class>org.exoplatform.web.login.ClusteredSSOFilter</filter-class>
</filter>
+
+ <filter>
+ <filter-name>PortalContainerFilter</filter-name>
+
<filter-class>org.exoplatform.container.web.PortalContainerFilter</filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>PortalContainerFilter</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
<filter-mapping>
<filter-name>RememberMeFilter</filter-name>
Show replies by date