Author: thomas.heute(a)jboss.com
Date: 2007-07-12 09:13:27 -0400 (Thu, 12 Jul 2007)
New Revision: 7734
Added:
branches/JBoss_Portal_Branch_2_6/faces/src/main/org/jboss/portal/faces/loader/
branches/JBoss_Portal_Branch_2_6/faces/src/main/org/jboss/portal/faces/loader/FacesClassLoader.java
branches/JBoss_Portal_Branch_2_6/faces/src/main/org/jboss/portal/faces/loader/FacesLoaderServlet.java
branches/JBoss_Portal_Branch_2_6/faces/src/main/org/jboss/portal/faces/loader/FacesPortlet.java
Removed:
branches/JBoss_Portal_Branch_2_6/faces/src/main/org/jboss/portal/faces/loader/FacesClassLoader.java
branches/JBoss_Portal_Branch_2_6/faces/src/main/org/jboss/portal/faces/loader/FacesLoaderServlet.java
branches/JBoss_Portal_Branch_2_6/faces/src/main/org/jboss/portal/faces/loader/FacesPortlet.java
branches/JBoss_Portal_Branch_2_6/faces/src/main/org/jboss/portal/faces/portlet/
Modified:
branches/JBoss_Portal_Branch_2_6/core-admin/build.xml
branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/portlet.xml
branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/web.xml
branches/JBoss_Portal_Branch_2_6/faces/build.xml
Log:
Removed JSF MetaBridge
Added Servlet wrapper in core-admin
Modified: branches/JBoss_Portal_Branch_2_6/core-admin/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-admin/build.xml 2007-07-12 12:43:58 UTC (rev
7733)
+++ branches/JBoss_Portal_Branch_2_6/core-admin/build.xml 2007-07-12 13:13:27 UTC (rev
7734)
@@ -186,31 +186,35 @@
<!-- portal-core-admin-lib.jar -->
<jar jarfile="${build.lib}/portal-core-admin-lib.jar">
- <fileset dir="${build.classes}">
- </fileset>
+ <fileset dir="${build.classes}"/>
</jar>
+ <!-- portal-admin.war -->
+ <copy todir="${build.resources}/portal-admin-war/WEB-INF/lib2">
+ <fileset dir="${apache.myfaces.lib}"
includes="myfaces-api.jar,myfaces-impl.jar,jstl.jar"/>
+ <fileset dir="${build.lib}"
includes="portal-core-admin-lib.jar"/>
+ <fileset dir="${jboss.portal-faces.root}/lib"
includes="portal-faces-lib.jar"/>
+ <fileset dir="../core-admin/src/etc/sun-jsf"
includes="jsf-example.jar"/>
+ <fileset dir="${facelets.facelets.lib}"
includes="jsf-facelets.jar"/>
+ <fileset dir="${el.el.lib}"
includes="el-api.jar,el-ri.jar"/>
+ <fileset dir="${portals.bridges/jsf.portlet.lib}"
includes="jsf-portlet.jar"/>
+ </copy>
+ <copy todir="${build.resources}/portal-admin-war">
+ <fileset dir="${source.bin}/portal-admin-war"/>
+ </copy>
<!-- portal-admin.sar -->
<copy todir="${build.resources}/portal-admin.sar">
<fileset dir="${build.resources}/portal-admin-sar"/>
</copy>
<copy todir="${build.resources}/portal-admin.sar/lib">
- <fileset dir="${build.lib}"
includes="portal-core-admin-lib.jar"/>
-
- <!-- For JSF -->
- <fileset dir="${jboss.portal-faces.root}/lib"
includes="portal-faces-lib.jar"/>
- <fileset dir="${apache.myfaces.lib}" includes="myfaces-api.jar,
myfaces-impl.jar, jstl.jar"/>
+ <fileset dir="${jboss.portal-faces.root}/lib"
includes="portal-faces-loader-lib.jar"/>
<fileset dir="${commons.el.lib}"
includes="commons-el.jar"/>
<fileset dir="${apache.beanutils.lib}"
includes="commons-beanutils.jar"/>
<fileset dir="${apache.digester.lib}"
includes="commons-digester.jar"/>
- <fileset dir="${el.el.lib}" includes="el-api.jar,
el-ri.jar"/>
- <fileset dir="${facelets.facelets.lib}"
includes="jsf-facelets.jar"/>
- <fileset dir="../core-admin/src/etc/sun-jsf"
includes="jsf-example.jar"/>
</copy>
<copy
todir="${build.resources}/portal-admin.sar/portal-admin.war">
<fileset dir="${build.resources}/portal-admin-war"/>
- <fileset dir="${source.bin}/portal-admin-war"/>
</copy>
</target>
Modified:
branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/portlet.xml
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/portlet.xml 2007-07-12
12:43:58 UTC (rev 7733)
+++
branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/portlet.xml 2007-07-12
13:13:27 UTC (rev 7734)
@@ -31,7 +31,7 @@
<description>Administration Portlet</description>
<portlet-name>AdminPortlet</portlet-name>
<display-name>Administration Portlet</display-name>
-
<portlet-class>org.apache.myfaces.portlet.MyFacesGenericPortlet</portlet-class>
+
<portlet-class>org.jboss.portal.faces.loader.FacesPortlet</portlet-class>
<init-param>
<name>default-view</name>
<value>/WEB-INF/jsf/objects.xhtml</value>
@@ -49,7 +49,7 @@
<description>Dashboard Configurator Portlet</description>
<portlet-name>DashboardConfigPortlet</portlet-name>
<display-name>Dashboard Configurator Portlet</display-name>
-
<portlet-class>org.apache.myfaces.portlet.MyFacesGenericPortlet</portlet-class>
+
<portlet-class>org.jboss.portal.faces.loader.FacesPortlet</portlet-class>
<init-param>
<name>default-view</name>
<value>/WEB-INF/jsf/dashboard/dashboard.xhtml</value>
Modified:
branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/web.xml
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/web.xml 2007-07-12
12:43:58 UTC (rev 7733)
+++
branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/web.xml 2007-07-12
13:13:27 UTC (rev 7734)
@@ -77,17 +77,8 @@
<!-- The JSF servlet -->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
- <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+
<servlet-class>org.jboss.portal.faces.loader.FacesLoaderServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
- <context-param>
- <param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>
- <param-value>true</param-value>
- </context-param>
-
- <listener>
-
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
- </listener>
-
</web-app>
Modified: branches/JBoss_Portal_Branch_2_6/faces/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/faces/build.xml 2007-07-12 12:43:58 UTC (rev 7733)
+++ branches/JBoss_Portal_Branch_2_6/faces/build.xml 2007-07-12 13:13:27 UTC (rev 7734)
@@ -154,10 +154,16 @@
<!-- portal-faces-lib.jar -->
<mkdir dir="${build.lib}"/>
<jar jarfile="${build.lib}/portal-faces-lib.jar">
- <fileset dir="${build.classes}"/>
+ <fileset dir="${build.classes}"
excludes="org/jboss/portal/faces/loader/**"/>
<fileset dir="${build.resources}/portal-faces-lib-jar"
includes="**/*"/>
</jar>
+ <!-- portal-faces-loader-lib.jar -->
+ <mkdir dir="${build.lib}"/>
+ <jar jarfile="${build.lib}/portal-faces-loader-lib.jar">
+ <fileset dir="${build.classes}"
includes="org/jboss/portal/faces/loader/**"/>
+ </jar>
+
<!-- portal-faces.war -->
<mkdir dir="${build.resources}/portal-faces-war/WEB-INF/lib"/>
<copy todir="${build.resources}/portal-faces-war/WEB-INF/lib">
Copied: branches/JBoss_Portal_Branch_2_6/faces/src/main/org/jboss/portal/faces/loader
(from rev 7732, trunk/faces/src/main/org/jboss/portal/faces/loader)
Deleted:
branches/JBoss_Portal_Branch_2_6/faces/src/main/org/jboss/portal/faces/loader/FacesClassLoader.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/faces/loader/FacesClassLoader.java 2007-07-12
12:37:06 UTC (rev 7732)
+++
branches/JBoss_Portal_Branch_2_6/faces/src/main/org/jboss/portal/faces/loader/FacesClassLoader.java 2007-07-12
13:13:27 UTC (rev 7734)
@@ -1,86 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.faces.loader;
-
-import org.apache.log4j.Logger;
-
-import java.net.URLClassLoader;
-import java.net.URL;
-import java.util.Map;
-import java.util.HashMap;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class FacesClassLoader extends URLClassLoader
-{
-
- /** . */
- private final Logger log = Logger.getLogger(FacesClassLoader.class);
-
- public FacesClassLoader(URL[] urls, ClassLoader classLoader)
- {
- super(urls, classLoader);
- }
-
- private final Map cache = new HashMap();
-
- protected synchronized Class loadClass(String name, boolean resolve) throws
ClassNotFoundException
- {
- if (name.startsWith("javax.faces") ||
name.startsWith("org.apache.myfaces"))
- {
- log.debug("Want to load " + name + " locally");
- return locateClass(name);
- }
-
- //
- try
- {
- log.debug("Want to load " + name + " will delegate");
- return super.loadClass(name, resolve);
- }
- catch (ClassNotFoundException e)
- {
- log.debug("Not found in the parent will try to load " + name + "
locally");
- return locateClass(name);
- }
- }
-
- private Class locateClass(String name) throws ClassNotFoundException
- {
- //
- Class clazz = (Class)cache.get(name);
-
- //
- if (clazz == null)
- {
- clazz = findClass(name);
- cache.put(name, clazz);
- }
-
- //
- return clazz;
- }
-
-}
Copied:
branches/JBoss_Portal_Branch_2_6/faces/src/main/org/jboss/portal/faces/loader/FacesClassLoader.java
(from rev 7732, trunk/faces/src/main/org/jboss/portal/faces/loader/FacesClassLoader.java)
===================================================================
---
branches/JBoss_Portal_Branch_2_6/faces/src/main/org/jboss/portal/faces/loader/FacesClassLoader.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/faces/src/main/org/jboss/portal/faces/loader/FacesClassLoader.java 2007-07-12
13:13:27 UTC (rev 7734)
@@ -0,0 +1,86 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.faces.loader;
+
+import org.apache.log4j.Logger;
+
+import java.net.URLClassLoader;
+import java.net.URL;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class FacesClassLoader extends URLClassLoader
+{
+
+ /** . */
+ private final Logger log = Logger.getLogger(FacesClassLoader.class);
+
+ public FacesClassLoader(URL[] urls, ClassLoader classLoader)
+ {
+ super(urls, classLoader);
+ }
+
+ private final Map cache = new HashMap();
+
+ protected synchronized Class loadClass(String name, boolean resolve) throws
ClassNotFoundException
+ {
+ if (name.startsWith("javax.faces") ||
name.startsWith("org.apache.myfaces"))
+ {
+ log.debug("Want to load " + name + " locally");
+ return locateClass(name);
+ }
+
+ //
+ try
+ {
+ log.debug("Want to load " + name + " will delegate");
+ return super.loadClass(name, resolve);
+ }
+ catch (ClassNotFoundException e)
+ {
+ log.debug("Not found in the parent will try to load " + name + "
locally");
+ return locateClass(name);
+ }
+ }
+
+ private Class locateClass(String name) throws ClassNotFoundException
+ {
+ //
+ Class clazz = (Class)cache.get(name);
+
+ //
+ if (clazz == null)
+ {
+ clazz = findClass(name);
+ cache.put(name, clazz);
+ }
+
+ //
+ return clazz;
+ }
+
+}
Deleted:
branches/JBoss_Portal_Branch_2_6/faces/src/main/org/jboss/portal/faces/loader/FacesLoaderServlet.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/faces/loader/FacesLoaderServlet.java 2007-07-12
12:37:06 UTC (rev 7732)
+++
branches/JBoss_Portal_Branch_2_6/faces/src/main/org/jboss/portal/faces/loader/FacesLoaderServlet.java 2007-07-12
13:13:27 UTC (rev 7734)
@@ -1,195 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.faces.loader;
-
-import org.apache.log4j.Logger;
-
-import javax.servlet.http.HttpServlet;
-import javax.servlet.ServletException;
-import javax.servlet.ServletContext;
-import javax.servlet.Servlet;
-import javax.servlet.ServletContextListener;
-import javax.servlet.ServletContextEvent;
-import java.net.URL;
-import java.util.ArrayList;
-import java.io.File;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class FacesLoaderServlet extends HttpServlet
-{
-
- /** . */
- private final static Logger log = Logger.getLogger(FacesLoaderServlet.class);
-
- /** . */
- private final String servletContextListenerClassName =
"org.apache.myfaces.webapp.StartupServletContextListener";
-
- /** . */
- private FacesClassLoader loader;
-
- /** . */
- private ServletContextListener listener;
-
- /** . */
- private Servlet servlet;
-
- public void init() throws ServletException
- {
- try
- {
- ServletContext ctx = getServletConfig().getServletContext();
-
- ArrayList tmp = new ArrayList();
- File f = new File(ctx.getRealPath("/WEB-INF/lib2/"));
- File[] libs = f.listFiles();
- for (int i = 0; i < libs.length; i++)
- {
- File lib = libs[i];
- URL libURL = lib.toURL();
- log.debug("Added " + libURL + " to faces class loader");
- tmp.add(libURL);
- }
- URL[] urls = (URL[])tmp.toArray(new URL[tmp.size()]);
-
- //
- loader = new FacesClassLoader(urls,
Thread.currentThread().getContextClassLoader());
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
-
- //
- if (loader != null)
- {
-
getServletConfig().getServletContext().setAttribute("FACESCLASSLOADER",
loader);
- ClassLoader containerLoader = Thread.currentThread().getContextClassLoader();
- Thread.currentThread().setContextClassLoader(loader);
-
- //
- try
- {
- // Perform myfaces bootstrap
- initMyFaces();
-
- //
- initFacesServlet();
- }
- finally
- {
- Thread.currentThread().setContextClassLoader(containerLoader);
- }
- }
- }
-
- public void destroy()
- {
- if (loader != null)
- {
- ClassLoader containerLoader = Thread.currentThread().getContextClassLoader();
- Thread.currentThread().setContextClassLoader(loader);
-
- //
- try
- {
- //
- destroyFacesServlet();
-
- //
- destroyMyFaces();
- }
- finally
- {
- Thread.currentThread().setContextClassLoader(containerLoader);
- }
- }
- }
-
-
- private void initFacesServlet()
- {
- try
- {
- Class facesServletClass =
loader.loadClass("javax.faces.webapp.FacesServlet");
- servlet = (Servlet)facesServletClass.newInstance();
- servlet.init(getServletConfig());
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-
- private void destroyFacesServlet()
- {
- if (servlet != null)
- {
- servlet.destroy();
- }
- }
-
- private void initMyFaces()
- {
- try
- {
- Class bridgeClass =
Thread.currentThread().getContextClassLoader().loadClass(servletContextListenerClassName);
- log.debug("Obtain bridge bootstrap class " + bridgeClass.getName());
- listener = (ServletContextListener)bridgeClass.newInstance();
- }
- catch (ClassNotFoundException e)
- {
- // It is not an error, this happens when we run with Sun RI
- log.debug("Bridge bootstrap not available " +
servletContextListenerClassName, e);
- }
- catch (IllegalAccessException e)
- {
- log.error("Bridge bootstrap not accessible " +
servletContextListenerClassName, e);
- }
- catch (InstantiationException e)
- {
- log.error("Bridge bootstrap not instantiable " +
servletContextListenerClassName, e);
- }
-
- //
- if (listener != null)
- {
- log.debug("About to initialize the bridge bootstrap");
- ServletContextEvent event = new
ServletContextEvent(getServletConfig().getServletContext());
- listener.contextInitialized(event);
- }
- }
-
- private void destroyMyFaces()
- {
- if (listener != null)
- {
- log.debug("About to destroy the bridge bootstrap");
- ServletContextEvent event = new
ServletContextEvent(getServletConfig().getServletContext());
- listener.contextDestroyed(event);
- }
- }
-
-}
Copied:
branches/JBoss_Portal_Branch_2_6/faces/src/main/org/jboss/portal/faces/loader/FacesLoaderServlet.java
(from rev 7732,
trunk/faces/src/main/org/jboss/portal/faces/loader/FacesLoaderServlet.java)
===================================================================
---
branches/JBoss_Portal_Branch_2_6/faces/src/main/org/jboss/portal/faces/loader/FacesLoaderServlet.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/faces/src/main/org/jboss/portal/faces/loader/FacesLoaderServlet.java 2007-07-12
13:13:27 UTC (rev 7734)
@@ -0,0 +1,195 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.faces.loader;
+
+import org.apache.log4j.Logger;
+
+import javax.servlet.http.HttpServlet;
+import javax.servlet.ServletException;
+import javax.servlet.ServletContext;
+import javax.servlet.Servlet;
+import javax.servlet.ServletContextListener;
+import javax.servlet.ServletContextEvent;
+import java.net.URL;
+import java.util.ArrayList;
+import java.io.File;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class FacesLoaderServlet extends HttpServlet
+{
+
+ /** . */
+ private final static Logger log = Logger.getLogger(FacesLoaderServlet.class);
+
+ /** . */
+ private final String servletContextListenerClassName =
"org.apache.myfaces.webapp.StartupServletContextListener";
+
+ /** . */
+ private FacesClassLoader loader;
+
+ /** . */
+ private ServletContextListener listener;
+
+ /** . */
+ private Servlet servlet;
+
+ public void init() throws ServletException
+ {
+ try
+ {
+ ServletContext ctx = getServletConfig().getServletContext();
+
+ ArrayList tmp = new ArrayList();
+ File f = new File(ctx.getRealPath("/WEB-INF/lib2/"));
+ File[] libs = f.listFiles();
+ for (int i = 0; i < libs.length; i++)
+ {
+ File lib = libs[i];
+ URL libURL = lib.toURL();
+ log.debug("Added " + libURL + " to faces class loader");
+ tmp.add(libURL);
+ }
+ URL[] urls = (URL[])tmp.toArray(new URL[tmp.size()]);
+
+ //
+ loader = new FacesClassLoader(urls,
Thread.currentThread().getContextClassLoader());
+ }
+ catch (Exception e)
+ {
+ throw new ServletException("Cannot find WEB-INF/lib2 directory to load
libraries from", e);
+ }
+
+ //
+ if (loader != null)
+ {
+
getServletConfig().getServletContext().setAttribute("FACESCLASSLOADER",
loader);
+ ClassLoader containerLoader = Thread.currentThread().getContextClassLoader();
+ Thread.currentThread().setContextClassLoader(loader);
+
+ //
+ try
+ {
+ // Perform myfaces bootstrap
+ initMyFaces();
+
+ //
+ initFacesServlet();
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(containerLoader);
+ }
+ }
+ }
+
+ public void destroy()
+ {
+ if (loader != null)
+ {
+ ClassLoader containerLoader = Thread.currentThread().getContextClassLoader();
+ Thread.currentThread().setContextClassLoader(loader);
+
+ //
+ try
+ {
+ //
+ destroyFacesServlet();
+
+ //
+ destroyMyFaces();
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(containerLoader);
+ }
+ }
+ }
+
+
+ private void initFacesServlet()
+ {
+ try
+ {
+ Class facesServletClass =
loader.loadClass("javax.faces.webapp.FacesServlet");
+ servlet = (Servlet)facesServletClass.newInstance();
+ servlet.init(getServletConfig());
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ private void destroyFacesServlet()
+ {
+ if (servlet != null)
+ {
+ servlet.destroy();
+ }
+ }
+
+ private void initMyFaces()
+ {
+ try
+ {
+ Class bridgeClass =
Thread.currentThread().getContextClassLoader().loadClass(servletContextListenerClassName);
+ log.debug("Obtain bridge bootstrap class " + bridgeClass.getName());
+ listener = (ServletContextListener)bridgeClass.newInstance();
+ }
+ catch (ClassNotFoundException e)
+ {
+ // It is not an error, this happens when we run with Sun RI
+ log.debug("Bridge bootstrap not available " +
servletContextListenerClassName, e);
+ }
+ catch (IllegalAccessException e)
+ {
+ log.error("Bridge bootstrap not accessible " +
servletContextListenerClassName, e);
+ }
+ catch (InstantiationException e)
+ {
+ log.error("Bridge bootstrap not instantiable " +
servletContextListenerClassName, e);
+ }
+
+ //
+ if (listener != null)
+ {
+ log.debug("About to initialize the bridge bootstrap");
+ ServletContextEvent event = new
ServletContextEvent(getServletConfig().getServletContext());
+ listener.contextInitialized(event);
+ }
+ }
+
+ private void destroyMyFaces()
+ {
+ if (listener != null)
+ {
+ log.debug("About to destroy the bridge bootstrap");
+ ServletContextEvent event = new
ServletContextEvent(getServletConfig().getServletContext());
+ listener.contextDestroyed(event);
+ }
+ }
+
+}
Deleted:
branches/JBoss_Portal_Branch_2_6/faces/src/main/org/jboss/portal/faces/loader/FacesPortlet.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/faces/loader/FacesPortlet.java 2007-07-12
12:37:06 UTC (rev 7732)
+++
branches/JBoss_Portal_Branch_2_6/faces/src/main/org/jboss/portal/faces/loader/FacesPortlet.java 2007-07-12
13:13:27 UTC (rev 7734)
@@ -1,118 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.faces.loader;
-
-import javax.portlet.Portlet;
-import javax.portlet.PortletConfig;
-import javax.portlet.PortletException;
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.PortletSecurityException;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import java.io.IOException;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class FacesPortlet implements Portlet
-{
-
- /** . */
- private Portlet portlet;
-
- /** . */
- private ClassLoader loader;
-
- public void init(PortletConfig config) throws PortletException
- {
- try
- {
- loader =
(ClassLoader)config.getPortletContext().getAttribute("FACESCLASSLOADER");
- if (loader != null)
- {
- ClassLoader containerLoader =
Thread.currentThread().getContextClassLoader();
- Thread.currentThread().setContextClassLoader(loader);
- try
- {
- Class facesServletClass =
loader.loadClass("org.apache.myfaces.portlet.MyFacesGenericPortlet");
- portlet = (Portlet)facesServletClass.newInstance();
- portlet.init(config);
- }
- finally
- {
- Thread.currentThread().setContextClassLoader(containerLoader);
- }
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-
- public void processAction(ActionRequest request, ActionResponse response) throws
PortletException, PortletSecurityException, IOException
- {
- if (portlet != null)
- {
- ClassLoader containerLoader = Thread.currentThread().getContextClassLoader();
- Thread.currentThread().setContextClassLoader(loader);
- try
- {
- portlet.processAction(request, response);
- }
- finally
- {
- Thread.currentThread().setContextClassLoader(containerLoader);
- }
- }
- }
-
- public void render(RenderRequest request, RenderResponse response) throws
PortletException, PortletSecurityException, IOException
- {
- if (portlet != null)
- {
- ClassLoader containerLoader = Thread.currentThread().getContextClassLoader();
- Thread.currentThread().setContextClassLoader(loader);
- try
- {
- portlet.render(request, response);
- }
- finally
- {
- Thread.currentThread().setContextClassLoader(containerLoader);
- }
- }
- }
-
- public void destroy()
- {
- if (portlet != null)
- {
- portlet.destroy();
- portlet = null;
- loader = null;
- }
- }
-}
Copied:
branches/JBoss_Portal_Branch_2_6/faces/src/main/org/jboss/portal/faces/loader/FacesPortlet.java
(from rev 7732, trunk/faces/src/main/org/jboss/portal/faces/loader/FacesPortlet.java)
===================================================================
---
branches/JBoss_Portal_Branch_2_6/faces/src/main/org/jboss/portal/faces/loader/FacesPortlet.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/faces/src/main/org/jboss/portal/faces/loader/FacesPortlet.java 2007-07-12
13:13:27 UTC (rev 7734)
@@ -0,0 +1,118 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.faces.loader;
+
+import javax.portlet.Portlet;
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletException;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class FacesPortlet implements Portlet
+{
+
+ /** . */
+ private Portlet portlet;
+
+ /** . */
+ private ClassLoader loader;
+
+ public void init(PortletConfig config) throws PortletException
+ {
+ try
+ {
+ loader =
(ClassLoader)config.getPortletContext().getAttribute("FACESCLASSLOADER");
+ if (loader != null)
+ {
+ ClassLoader containerLoader =
Thread.currentThread().getContextClassLoader();
+ Thread.currentThread().setContextClassLoader(loader);
+ try
+ {
+ Class facesServletClass =
loader.loadClass("org.apache.myfaces.portlet.MyFacesGenericPortlet");
+ portlet = (Portlet)facesServletClass.newInstance();
+ portlet.init(config);
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(containerLoader);
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public void processAction(ActionRequest request, ActionResponse response) throws
PortletException, PortletSecurityException, IOException
+ {
+ if (portlet != null)
+ {
+ ClassLoader containerLoader = Thread.currentThread().getContextClassLoader();
+ Thread.currentThread().setContextClassLoader(loader);
+ try
+ {
+ portlet.processAction(request, response);
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(containerLoader);
+ }
+ }
+ }
+
+ public void render(RenderRequest request, RenderResponse response) throws
PortletException, PortletSecurityException, IOException
+ {
+ if (portlet != null)
+ {
+ ClassLoader containerLoader = Thread.currentThread().getContextClassLoader();
+ Thread.currentThread().setContextClassLoader(loader);
+ try
+ {
+ portlet.render(request, response);
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(containerLoader);
+ }
+ }
+ }
+
+ public void destroy()
+ {
+ if (portlet != null)
+ {
+ portlet.destroy();
+ portlet = null;
+ loader = null;
+ }
+ }
+}