Author: julien(a)jboss.com
Date: 2007-03-28 05:57:01 -0400 (Wed, 28 Mar 2007)
New Revision: 6857
Modified:
trunk/server/src/main/org/jboss/portal/server/deployment/PortalWebTomcat5App.java
trunk/server/src/main/org/jboss/portal/server/deployment/PortalWebTomcat6App.java
trunk/theme/src/main/org/jboss/portal/theme/LayoutDispatcher.java
Log:
remove the filter integration that is not used anymore
Modified:
trunk/server/src/main/org/jboss/portal/server/deployment/PortalWebTomcat5App.java
===================================================================
---
trunk/server/src/main/org/jboss/portal/server/deployment/PortalWebTomcat5App.java 2007-03-28
00:56:31 UTC (rev 6856)
+++
trunk/server/src/main/org/jboss/portal/server/deployment/PortalWebTomcat5App.java 2007-03-28
09:57:01 UTC (rev 6857)
@@ -22,7 +22,6 @@
******************************************************************************/
package org.jboss.portal.server.deployment;
-import org.jboss.portal.server.servlet.CommandFilter;
import org.jboss.portal.server.servlet.CommandServlet;
import org.jboss.web.WebApplication;
import org.xml.sax.EntityResolver;
@@ -95,9 +94,6 @@
Object commandServlet = findChildMethod.invoke(standardContext, new
Object[]{"CommandServlet"});
if (commandServlet == null)
{
- addFilterDef(cl);
- addFilterMap(cl);
- startFilter(cl);
setRunAsListenerAssociation(webApp.getMetaData());
try
{
@@ -110,16 +106,6 @@
}
}
- private void startFilter(ClassLoader cl) throws Exception
- {
- // Get classes
- Class standardContextClass =
cl.loadClass("org.apache.catalina.core.StandardContext");
-
- // Start filters
- Method filterStartMethod = standardContextClass.getMethod("filterStart",
new Class[0]);
- filterStartMethod.invoke(standardContext, new Object[0]);
- }
-
private void setRunAsListenerAssociation(Object o)
{
try
@@ -146,49 +132,6 @@
}
}
- private void addFilterMap(ClassLoader cl) throws Exception
- {
- // Get classes
- Class containerItf = cl.loadClass("org.apache.catalina.Container");
- Class standardWrapperClass =
cl.loadClass("org.apache.catalina.core.StandardWrapper");
- Class filterMapClass =
cl.loadClass("org.apache.catalina.deploy.FilterMap");
- Class standardContextClass =
cl.loadClass("org.apache.catalina.core.StandardContext");
-
- // Get all the children
- Method findChildrenMethod = containerItf.getMethod("findChildren", new
Class[0]);
- Object[] chilren = (Object[])findChildrenMethod.invoke(standardContext, new
Object[0]);
-
- // Iterate
- for (int i = 0; i < chilren.length; i++)
- {
- Object child = chilren[i];
- Class childClass = child.getClass();
- if (childClass.equals(standardWrapperClass))
- {
- // If it is a wrapper we instrument
- Object filterMap = filterMapClass.newInstance();
-
- // Get servlet name
- Method getServletNameMethod =
standardWrapperClass.getMethod("getServletName", new Class[0]);
- String servletName = (String)getServletNameMethod.invoke(child, new
Object[0]);
-
- // Configure filter map
- Method setDispatcherMethod =
filterMapClass.getMethod("setDispatcher", new Class[]{String.class});
- setDispatcherMethod.invoke(filterMap, new Object[]{"INCLUDE"});
- Method FilterMapSetFilterNameMethod =
filterMapClass.getMethod("setFilterName", new Class[]{String.class});
- FilterMapSetFilterNameMethod.invoke(filterMap, new
Object[]{"CommandFilter"});
- Method setServletNameMethod =
filterMapClass.getMethod("setServletName", new Class[]{String.class});
- setServletNameMethod.invoke(filterMap, new Object[]{servletName});
- Method setURLPatternMethod =
filterMapClass.getMethod("setURLPattern", new Class[]{String.class});
- setURLPatternMethod.invoke(filterMap, new Object[]{null});
-
- // Add the filter map
- Method addFilterMapMethod =
standardContextClass.getMethod("addFilterMap", new Class[]{filterMapClass});
- addFilterMapMethod.invoke(standardContext, new Object[]{filterMap});
- }
- }
- }
-
private void addCommandServlet(ClassLoader cl) throws Exception
{
//
@@ -223,44 +166,6 @@
loadOnStartupMethod.invoke(standardContext, new Object[]{wrapperArray});
}
- private void addFilterDef(ClassLoader cl) throws Exception
- {
- // Get class
- Class standardContextClass =
cl.loadClass("org.apache.catalina.core.StandardContext");
- Class filterDefClass =
cl.loadClass("org.apache.catalina.deploy.FilterDef");
-
- // Create filter def
- Object filterDef = filterDefClass.newInstance();
-
- //
- Method setDescriptionMethod = filterDefClass.getMethod("setDescription",
new Class[]{String.class});
- setDescriptionMethod.invoke(filterDef, new Object[]{""});
-
- //
- Method setDisplayNameMethod = filterDefClass.getMethod("setDisplayName",
new Class[]{String.class});
- setDisplayNameMethod.invoke(filterDef, new Object[]{""});
-
- //
- Method setFilterClassMethod = filterDefClass.getMethod("setFilterClass",
new Class[]{String.class});
- setFilterClassMethod.invoke(filterDef, new
Object[]{CommandFilter.class.getName()});
-
- //
- Method FilterDefSetFilterNameMethod =
filterDefClass.getMethod("setFilterName", new Class[]{String.class});
- FilterDefSetFilterNameMethod.invoke(filterDef, new
Object[]{"CommandFilter"});
-
- //
- Method setLargeIconMethod = filterDefClass.getMethod("setLargeIcon", new
Class[]{String.class});
- setLargeIconMethod.invoke(filterDef, new Object[]{""});
-
- //
- Method setSmallIconMethod = filterDefClass.getMethod("setSmallIcon", new
Class[]{String.class});
- setSmallIconMethod.invoke(filterDef, new Object[]{""});
-
- // Finally add the filter def
- Method addFilterDefMethod =
standardContextClass.getMethod("addFilterDef", new Class[]{filterDefClass});
- addFilterDefMethod.invoke(standardContext, new Object[]{filterDef});
- }
-
private ClassLoader getClassLoader(MBeanServer server, ObjectName name) throws
Exception
{
Object loader = server.getAttribute(name, "loader");
Modified:
trunk/server/src/main/org/jboss/portal/server/deployment/PortalWebTomcat6App.java
===================================================================
---
trunk/server/src/main/org/jboss/portal/server/deployment/PortalWebTomcat6App.java 2007-03-28
00:56:31 UTC (rev 6856)
+++
trunk/server/src/main/org/jboss/portal/server/deployment/PortalWebTomcat6App.java 2007-03-28
09:57:01 UTC (rev 6857)
@@ -24,7 +24,6 @@
import org.jboss.web.WebApplication;
import org.jboss.portal.server.servlet.CommandServlet;
-import org.jboss.portal.server.servlet.CommandFilter;
import org.xml.sax.EntityResolver;
import javax.management.MBeanServer;
@@ -69,7 +68,7 @@
}
catch (Exception e)
{
- CannotCreatePortletWebAppException ex = null;
+ CannotCreatePortletWebAppException ex;
if (e instanceof CannotCreatePortletWebAppException)
{
ex = (CannotCreatePortletWebAppException)e;
@@ -95,9 +94,6 @@
Object commandServlet = findChildMethod.invoke(standardContext, new
Object[]{"CommandServlet"});
if (commandServlet == null)
{
- addFilterDef(cl);
- addFilterMap(cl);
- startFilter(cl);
setRunAsListenerAssociation(webApp.getMetaData());
try
{
@@ -110,16 +106,6 @@
}
}
- private void startFilter(ClassLoader cl) throws Exception
- {
- // Get classes
- Class standardContextClass =
cl.loadClass("org.apache.catalina.core.StandardContext");
-
- // Start filters
- Method filterStartMethod = standardContextClass.getMethod("filterStart",
new Class[0]);
- filterStartMethod.invoke(standardContext, new Object[0]);
- }
-
private void setRunAsListenerAssociation(Object o)
{
try
@@ -146,47 +132,6 @@
}
}
- private void addFilterMap(ClassLoader cl) throws Exception
- {
- // Get classes
- Class containerItf = cl.loadClass("org.apache.catalina.Container");
- Class standardWrapperClass =
cl.loadClass("org.apache.catalina.core.StandardWrapper");
- Class filterMapClass =
cl.loadClass("org.apache.catalina.deploy.FilterMap");
- Class standardContextClass =
cl.loadClass("org.apache.catalina.core.StandardContext");
-
- // Get all the children
- Method findChildrenMethod = containerItf.getMethod("findChildren", new
Class[0]);
- Object[] chilren = (Object[])findChildrenMethod.invoke(standardContext, new
Object[0]);
-
- // Iterate
- for (int i = 0; i < chilren.length; i++)
- {
- Object child = chilren[i];
- Class childClass = child.getClass();
- if (childClass.equals(standardWrapperClass))
- {
- // If it is a wrapper we instrument
- Object filterMap = filterMapClass.newInstance();
-
- // Get servlet name
- Method getServletNameMethod =
standardWrapperClass.getMethod("getServletName", new Class[0]);
- String servletName = (String)getServletNameMethod.invoke(child, new
Object[0]);
-
- // Configure filter map
- Method setDispatcherMethod =
filterMapClass.getMethod("setDispatcher", new Class[]{String.class});
- setDispatcherMethod.invoke(filterMap, new Object[]{"INCLUDE"});
- Method FilterMapSetFilterNameMethod =
filterMapClass.getMethod("setFilterName", new Class[]{String.class});
- FilterMapSetFilterNameMethod.invoke(filterMap, new
Object[]{"CommandFilter"});
- Method setServletNameMethod =
filterMapClass.getMethod("addServletName", new Class[]{String.class});
- setServletNameMethod.invoke(filterMap, new Object[]{servletName});
-
- // Add the filter map
- Method addFilterMapMethod =
standardContextClass.getMethod("addFilterMap", new Class[]{filterMapClass});
- addFilterMapMethod.invoke(standardContext, new Object[]{filterMap});
- }
- }
- }
-
private void addCommandServlet(ClassLoader cl) throws Exception
{
//
@@ -220,45 +165,7 @@
Method loadOnStartupMethod =
standardContextClass.getMethod("loadOnStartup", new
Class[]{wrapperArray.getClass()});
loadOnStartupMethod.invoke(standardContext, new Object[]{wrapperArray});
}
-
- private void addFilterDef(ClassLoader cl) throws Exception
- {
- // Get class
- Class standardContextClass =
cl.loadClass("org.apache.catalina.core.StandardContext");
- Class filterDefClass =
cl.loadClass("org.apache.catalina.deploy.FilterDef");
-
- // Create filter def
- Object filterDef = filterDefClass.newInstance();
-
- //
- Method setDescriptionMethod = filterDefClass.getMethod("setDescription",
new Class[]{String.class});
- setDescriptionMethod.invoke(filterDef, new Object[]{""});
-
- //
- Method setDisplayNameMethod = filterDefClass.getMethod("setDisplayName",
new Class[]{String.class});
- setDisplayNameMethod.invoke(filterDef, new Object[]{""});
-
- //
- Method setFilterClassMethod = filterDefClass.getMethod("setFilterClass",
new Class[]{String.class});
- setFilterClassMethod.invoke(filterDef, new
Object[]{CommandFilter.class.getName()});
-
- //
- Method FilterDefSetFilterNameMethod =
filterDefClass.getMethod("setFilterName", new Class[]{String.class});
- FilterDefSetFilterNameMethod.invoke(filterDef, new
Object[]{"CommandFilter"});
-
- //
- Method setLargeIconMethod = filterDefClass.getMethod("setLargeIcon", new
Class[]{String.class});
- setLargeIconMethod.invoke(filterDef, new Object[]{""});
-
- //
- Method setSmallIconMethod = filterDefClass.getMethod("setSmallIcon", new
Class[]{String.class});
- setSmallIconMethod.invoke(filterDef, new Object[]{""});
-
- // Finally add the filter def
- Method addFilterDefMethod =
standardContextClass.getMethod("addFilterDef", new Class[]{filterDefClass});
- addFilterDefMethod.invoke(standardContext, new Object[]{filterDef});
- }
-
+
private ClassLoader getClassLoader(MBeanServer server, ObjectName name) throws
Exception
{
Object loader = server.getAttribute(name, "loader");
Modified: trunk/theme/src/main/org/jboss/portal/theme/LayoutDispatcher.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/LayoutDispatcher.java 2007-03-28 00:56:31
UTC (rev 6856)
+++ trunk/theme/src/main/org/jboss/portal/theme/LayoutDispatcher.java 2007-03-28 09:57:01
UTC (rev 6857)
@@ -46,7 +46,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
-public final class LayoutDispatcher implements FilterCommand
+public final class LayoutDispatcher
{
private static final Logger log = Logger.getLogger(LayoutDispatcher.class);
@@ -92,21 +92,6 @@
this.renderContext = renderContext;
}
- public void execute(HttpServletRequest req, HttpServletResponse resp, FilterChain
chain) throws ServletException, IOException
- {
- // This request returns a context path which is the one of the war file in which
the target is
- HttpServletRequest wrapper = new HttpServletRequestWrapper(req)
- {
- public String getContextPath()
- {
- return renderContext.getLayoutInfo().getContextPath();
- }
- };
-
- // Execute the target
- chain.doFilter(wrapper, resp);
- }
-
/** Perform the dispatch to the target layout */
// public void include(PortalRequest req, PortalResponse resp) throws IOException,
ServletException
public void include() throws IOException, ServletException
@@ -132,8 +117,18 @@
// add the results to the request
request.setAttribute(LayoutConstants.ATTR_PAGE, markupResult);
- dispatcher.include(request, response);
+ // This request returns a context path which is the one of the war file in
which the target is
+ HttpServletRequest wrapper = new HttpServletRequestWrapper(request)
+ {
+ public String getContextPath()
+ {
+ return renderContext.getLayoutInfo().getContextPath();
+ }
+ };
+
+ dispatcher.include(wrapper, response);
+
log.debug("done with the layout");
}
else