Author: hoang_to
Date: 2010-08-11 22:13:07 -0400 (Wed, 11 Aug 2010)
New Revision: 3806
Modified:
portal/branches/branched-r3776/component/web/resources/src/main/java/org/exoplatform/portal/resource/GateInSkinConfigRemoval.java
portal/branches/branched-r3776/component/web/resources/src/main/java/org/exoplatform/portal/resource/MainResourceResolver.java
portal/branches/branched-r3776/component/web/resources/src/main/java/org/exoplatform/portal/resource/SkinService.java
Log:
Apply patch of GTNPORTAL-1392
Modified:
portal/branches/branched-r3776/component/web/resources/src/main/java/org/exoplatform/portal/resource/GateInSkinConfigRemoval.java
===================================================================
---
portal/branches/branched-r3776/component/web/resources/src/main/java/org/exoplatform/portal/resource/GateInSkinConfigRemoval.java 2010-08-12
02:03:01 UTC (rev 3805)
+++
portal/branches/branched-r3776/component/web/resources/src/main/java/org/exoplatform/portal/resource/GateInSkinConfigRemoval.java 2010-08-12
02:13:07 UTC (rev 3806)
@@ -21,6 +21,8 @@
import java.util.List;
import java.util.Set;
+import javax.servlet.ServletContext;
+
import org.gatein.wci.WebAppEvent;
import org.gatein.wci.WebAppLifeCycleEvent;
@@ -56,6 +58,7 @@
{
String webApp = event.getWebApp().getServletContext().getContextPath();
removeWebAppSkin(webApp);
+ removeContextAppSkin(event.getWebApp().getServletContext());
}
}
}
@@ -77,6 +80,11 @@
}
}
+ private void removeContextAppSkin(ServletContext servletContext)
+ {
+ service.unregisterServletContext(servletContext);
+ }
+
private void removePortalSkins(String webApp) throws Exception
{
List<SkinKey> portalSkins = SkinDependentManager.getPortalSkins(webApp);
Modified:
portal/branches/branched-r3776/component/web/resources/src/main/java/org/exoplatform/portal/resource/MainResourceResolver.java
===================================================================
---
portal/branches/branched-r3776/component/web/resources/src/main/java/org/exoplatform/portal/resource/MainResourceResolver.java 2010-08-12
02:03:01 UTC (rev 3805)
+++
portal/branches/branched-r3776/component/web/resources/src/main/java/org/exoplatform/portal/resource/MainResourceResolver.java 2010-08-12
02:13:07 UTC (rev 3806)
@@ -57,6 +57,13 @@
resolvers.add(new CompositeResourceResolver(portalContainerName, skins));
}
+ /**
+ * Register a servlet request context
+ * <p>Append a servlet context to the map of contexts if servlet context name is
not existing
+ *
+ * @param servletContext servlet context which want to append
+ * @return
+ */
SimpleResourceContext registerContext(ServletContext servletContext)
{
String key = "/" + servletContext.getServletContextName();
@@ -68,6 +75,25 @@
}
return ctx;
}
+
+ /**
+ * Remove a servlet context from map of contexts
+ *
+ * @param servletContext
+ */
+ public void removeServletContext(ServletContext servletContext)
+ {
+ String key = "/" + servletContext.getServletContextName();
+ SimpleResourceContext ctx = contexts.get(key);
+ if (ctx != null)
+ {
+ contexts.remove(ctx.getContextPath());
+ }
+ else {
+ log.warn("Cannot find servlet context module");
+ return;
+ }
+ }
public Resource resolve(String path)
{
Modified:
portal/branches/branched-r3776/component/web/resources/src/main/java/org/exoplatform/portal/resource/SkinService.java
===================================================================
---
portal/branches/branched-r3776/component/web/resources/src/main/java/org/exoplatform/portal/resource/SkinService.java 2010-08-12
02:03:01 UTC (rev 3805)
+++
portal/branches/branched-r3776/component/web/resources/src/main/java/org/exoplatform/portal/resource/SkinService.java 2010-08-12
02:13:07 UTC (rev 3806)
@@ -799,6 +799,16 @@
{
mainResolver.registerContext(sContext);
}
+
+ /**
+ * unregister a {@link ServletContext} into {@link MainResourceResolver} of {@link
SkinService}
+ *
+ * @param servletContext ServletContext will unregistered
+ */
+ public void unregisterServletContext(ServletContext servletContext)
+ {
+ mainResolver.removeServletContext(servletContext);
+ }
/**
* Clean cache, reload all Skins
Show replies by date