portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vku...@apache.org
Subject svn commit: r771950 - /portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/wicket/JetspeedContextAwareWicketFilter.java
Date Tue, 05 May 2009 18:13:49 GMT
Author: vkumar
Date: Tue May  5 18:13:48 2009
New Revision: 771950

URL: http://svn.apache.org/viewvc?rev=771950&view=rev
Log:
Fixing servlet app loading order problem.

Modified:
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/wicket/JetspeedContextAwareWicketFilter.java

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/wicket/JetspeedContextAwareWicketFilter.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/wicket/JetspeedContextAwareWicketFilter.java?rev=771950&r1=771949&r2=771950&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/wicket/JetspeedContextAwareWicketFilter.java
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/wicket/JetspeedContextAwareWicketFilter.java
Tue May  5 18:13:48 2009
@@ -17,6 +17,7 @@
 package org.apache.jetspeed.portlets.wicket;
 
 import org.apache.jetspeed.Jetspeed;
+import org.apache.jetspeed.components.ComponentManager;
 import org.apache.jetspeed.factory.PortletFactory;
 import org.apache.wicket.protocol.http.WicketFilter;
 
@@ -47,11 +48,20 @@
             try
             {
                 ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
-                PortletFactory portletFactory = (PortletFactory) Jetspeed.getComponentManager().getComponent("portletFactory");
-                MockPortletApplication layoutApp = new MockPortletApplication();
-                layoutApp.setName("jetspeed-layouts");
-                ClassLoader jetspeedContextClassLoader = portletFactory.getPortletApplicationClassLoader(layoutApp);
-                jetspeedContextAwareClassLoader = new JetspeedContextAwareClassLoader(contextClassLoader,
jetspeedContextClassLoader);
+                ComponentManager componentManager = Jetspeed.getComponentManager();
+                
+                if (componentManager != null)
+                {
+                    PortletFactory portletFactory = (PortletFactory) componentManager.getComponent("portletFactory");
+                    
+                    if (portletFactory != null)
+                    {
+                        MockPortletApplication layoutApp = new MockPortletApplication();
+                        layoutApp.setName("jetspeed-layouts");
+                        ClassLoader jetspeedContextClassLoader = portletFactory.getPortletApplicationClassLoader(layoutApp);
+                        jetspeedContextAwareClassLoader = new JetspeedContextAwareClassLoader(contextClassLoader,
jetspeedContextClassLoader);
+                    }
+                }
             }
             catch (Exception e)
             {
@@ -59,7 +69,7 @@
             }
         }
         
-        return jetspeedContextAwareClassLoader;
+        return (jetspeedContextAwareClassLoader != null ? jetspeedContextAwareClassLoader
: super.getClassLoader());
     }
 
     private class JetspeedContextAwareClassLoader extends ClassLoader



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message