summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSidharth Singh2013-03-08 05:15:59 (EST)
committer Sven Rottstock2013-03-11 07:26:30 (EDT)
commite0e4f9c918b7ab4d1b4e6438754ba7449423d30d (patch)
tree3e2a33ed8736640411b50dc8d2d30c429a8af0ad
parent6440434f0d50a4fcc54dc520fbe843f21d1056b1 (diff)
downloadorg.eclipse.stardust.ui.web-e0e4f9c918b7ab4d1b4e6438754ba7449423d30d.zip
org.eclipse.stardust.ui.web-e0e4f9c918b7ab4d1b4e6438754ba7449423d30d.tar.gz
org.eclipse.stardust.ui.web-e0e4f9c918b7ab4d1b4e6438754ba7449423d30d.tar.bz2
Jira-ID: CRNT-27828
Added try/catch block for AppContext.getResources("classpath*:META-INF/*.portal-plugin") in PortalPluginSkinResourceResolver Added code in catch block to retrieve resources from Sub-folder of classpath having "*.portal-plugin" extn , if META-INF folder is not found. git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ui.web@63603 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/common/PortalPluginSkinResourceResolver.java27
1 files changed, 22 insertions, 5 deletions
diff --git a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/common/PortalPluginSkinResourceResolver.java b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/common/PortalPluginSkinResourceResolver.java
index b9ca8c5..2e08e8f 100644
--- a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/common/PortalPluginSkinResourceResolver.java
+++ b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/common/PortalPluginSkinResourceResolver.java
@@ -21,13 +21,16 @@ import java.util.List;
import java.util.Map;
import java.util.TreeMap;
+import javax.faces.context.FacesContext;
+
import org.eclipse.stardust.common.CollectionUtils;
import org.eclipse.stardust.common.log.LogManager;
import org.eclipse.stardust.common.log.Logger;
import org.eclipse.stardust.common.utils.io.CloseableUtil;
+import org.springframework.context.ApplicationContext;
import org.springframework.core.io.Resource;
-import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.core.io.support.ResourcePatternResolver;
+import org.springframework.web.jsf.FacesContextUtils;
/**
*
@@ -39,7 +42,6 @@ public class PortalPluginSkinResourceResolver
public static final Logger trace = LogManager.getLogger(PortalPluginSkinResourceResolver.class);
public static final String IE_USER_AGENT = "_ie";
public static final String SAFARI_USER_AGENT = "_safari";
- private static ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
/**
*
@@ -58,8 +60,23 @@ public class PortalPluginSkinResourceResolver
});
try
{
- Resource[] resources = resolver.getResources("classpath*:/META-INF/*.portal-plugin");
- for (Resource resource : resources)
+ Resource[] resources = null;
+ ApplicationContext context = null;
+ try
+ {
+ context = FacesContextUtils.getWebApplicationContext(FacesContext.getCurrentInstance());
+ resources = context.getResources("classpath*:META-INF/*.portal-plugin");
+ }
+ catch (Exception e)
+ {
+ // JBoss is unable to find META-INF some times, workaround for the scenario
+ resources = context.getResources("classpath*:/**/*.portal-plugin");
+ }
+ if(CollectionUtils.isEmpty(resources))
+ {
+ return allExtensions;
+ }
+ for (Resource resource :resources)
{
String pluginId = resource.getFilename().substring(0, resource.getFilename().lastIndexOf("."));
String webUriPrefix = pluginId + "/";
@@ -78,7 +95,7 @@ public class PortalPluginSkinResourceResolver
List<Resource> extensionResources;
try
{
- extensionResources = discoverSkinExtensions(resolver, webContentBaseUri, pluginFolder, fileName);
+ extensionResources = discoverSkinExtensions(context, webContentBaseUri, pluginFolder, fileName);
}
// JBoss is throwing an IOException instead of FileNotFoundException if a
// file cannot be found