From john82@example.net Sun Jul 02 11:04:02 2006 Return-Path: <john82@example.net> Delivered-To: john82@example.net Received: (qmail 3173 invoked from network); 2 Jul 2006 11:04:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 2 Jul 2006 11:04:02 -0000 Received: (qmail 1943 invoked by uid 500); 2 Jul 2006 11:04:01 -0000 Delivered-To: john82@example.net Received: (qmail 1892 invoked by uid 500); 2 Jul 2006 11:04:00 -0000 Mailing-List: contact john82@example.net; run by ezmlm Precedence: bulk Reply-To: john82@example.net list-help: <mailto:john82@example.net> list-unsubscribe: <mailto:john82@example.net> List-Post: <mailto:john82@example.net> List-Id: <cvs.cocoon.apache.org> Delivered-To: mailing list john82@example.net Received: (qmail 1878 invoked by uid 99); 2 Jul 2006 11:04:00 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 02 Jul 2006 04:04:00 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 02 Jul 2006 04:03:57 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 3104B1A983A; Sun, 2 Jul 2006 04:03:37 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r418569 - in /cocoon/trunk: blocks/cocoon-auth/cocoon-auth-impl/src/main/java/org/apache/cocoon/auth/impl/ blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/ blocks/cocoon-portal/cocoon-portal-impl/src/main... Date: Sun, 02 Jul 2006 11:03:31 -0000 To: john82@example.net From: john82@example.net X-Mailer: svnmailer-1.0.8 Message-Id: <john82@example.net> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: cziegeler Date: Sun Jul 2 04:03:28 2006 New Revision: 418569 URL: http://svn.apache.org/viewvc?rev=418569&view=rev Log: More core cleanup to make Cocoon class and CocoonServlet class obsolete Readd RequestListener Add new DebugFilter PropertyProvider is now a regular Spring bean (like a custom logger) Added: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/DebugFilter.java (with props) Removed: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/SettingsHelper.java Modified: cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/java/org/apache/cocoon/auth/impl/StandardApplicationManager.java cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/pluto/adapter/PortletAdapter.java cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/pluto/om/PortletDefinitionRegistryImpl.java cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/pluto/services/factory/FactoryManagerServiceImpl.java cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/wsrp/adapter/WSRPAdapter.java cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/test/java/org/apache/cocoon/portal/AbstractPortalTestCase.java cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/Constants.java cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/ProcessingUtil.java cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/modules/input/SettingsInputModule.java cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/source/impl/ContextSourceFactory.java cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelineNodeBuilder.java cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/SitemapLanguage.java cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/BaseSettings.java cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/CoreUtil.java cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/MutableSettings.java cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/PropertyProvider.java cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/BeanFactoryUtil.java cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/osgi/OSGiSpringECMFactory.java cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/generation/StatusGenerator.java cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/CocoonServlet.java cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/CocoonServletListener.java cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/RequestProcessor.java cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/multipart/MultipartFilter.java cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/sitemap/SitemapServlet.java cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/SitemapTestCase.java cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/core/TestBootstrapEnvironment.java cocoon/trunk/core/cocoon-webapp/src/main/webapp/WEB-INF/web.xml Modified: cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/java/org/apache/cocoon/auth/impl/StandardApplicationManager.java URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/java/org/apache/cocoon/auth/impl/StandardApplicationManager.java?rev=418569&r1=418568&r2=418569&view=diff ============================================================================== --- cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/java/org/apache/cocoon/auth/impl/StandardApplicationManager.java (original) +++ cocoon/trunk/blocks/cocoon-auth/cocoon-auth-impl/src/main/java/org/apache/cocoon/auth/impl/StandardApplicationManager.java Sun Jul 2 04:03:28 2006 @@ -20,7 +20,7 @@ import java.util.Iterator; import java.util.Map; -import javax.servlet.ServletConfig; +import javax.servlet.ServletContext; import javax.servlet.http.HttpSession; import org.apache.avalon.framework.CascadingRuntimeException; @@ -34,11 +34,11 @@ import org.apache.avalon.framework.service.ServiceManager; import org.apache.avalon.framework.service.Serviceable; import org.apache.avalon.framework.thread.ThreadSafe; +import org.apache.cocoon.Constants; import org.apache.cocoon.components.ContextHelper; import org.apache.cocoon.environment.ObjectModelHelper; import org.apache.cocoon.environment.Request; import org.apache.cocoon.environment.Session; -import org.apache.cocoon.servlet.CocoonServlet; import org.apache.commons.lang.ObjectUtils; import org.apache.cocoon.auth.Application; import org.apache.cocoon.auth.ApplicationManager; @@ -80,10 +80,8 @@ public void contextualize(final Context aContext) throws ContextException { this.context = aContext; try { - ServletConfig config = - (ServletConfig)this.context.get(CocoonServlet.CONTEXT_SERVLET_CONFIG); - config.getServletContext().setAttribute(StandardApplicationManager.class.getName(), - this); + final ServletContext servletContext = (ServletContext)aContext.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT); + servletContext.setAttribute(StandardApplicationManager.class.getName(), this); } catch (ContextException ignore) { // we ignore this if we are not running inside a servlet environment } Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java?rev=418569&r1=418568&r2=418569&view=diff ============================================================================== --- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java (original) +++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java Sun Jul 2 04:03:28 2006 @@ -22,7 +22,7 @@ import java.util.List; import java.util.Map; -import javax.servlet.ServletConfig; +import javax.servlet.ServletContext; import org.apache.avalon.framework.activity.Disposable; import org.apache.avalon.framework.configuration.Configurable; @@ -36,6 +36,7 @@ import org.apache.avalon.framework.service.ServiceManager; import org.apache.avalon.framework.service.Serviceable; import org.apache.avalon.framework.thread.ThreadSafe; +import org.apache.cocoon.Constants; import org.apache.cocoon.components.ContextHelper; import org.apache.cocoon.environment.Request; import org.apache.cocoon.environment.Session; @@ -50,7 +51,6 @@ import org.apache.cocoon.portal.layout.SkinDescription; import org.apache.cocoon.portal.layout.renderer.Renderer; import org.apache.cocoon.portal.profile.ProfileManager; -import org.apache.cocoon.servlet.CocoonServlet; import org.apache.excalibur.source.Source; import org.apache.excalibur.source.SourceResolver; @@ -222,12 +222,12 @@ /** * @see org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context) */ - public void contextualize(Context context) throws ContextException { - this.context = context; + public void contextualize(Context aContext) throws ContextException { + this.context = aContext; // add the portal service to the servlet context - if available try { - final ServletConfig servletConfig = (ServletConfig) context.get(CocoonServlet.CONTEXT_SERVLET_CONFIG); - servletConfig.getServletContext().setAttribute(PortalService.ROLE, this); + final ServletContext servletContext = (ServletContext)aContext.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT); + servletContext.setAttribute(PortalService.ROLE, this); } catch (ContextException ignore) { // we ignore the context exception // this avoids startup errors if the portal is configured for the CLI @@ -244,11 +244,13 @@ this.portalComponentManager.dispose(); } // remove the portal service from the servlet context - if available - try { - final ServletConfig servletConfig = (ServletConfig) context.get(CocoonServlet.CONTEXT_SERVLET_CONFIG); - servletConfig.getServletContext().removeAttribute(PortalService.ROLE); - } catch (ContextException ignore) { - // we ignore the context exception + if ( this.context != null ) { + try { + final ServletContext servletContext = (ServletContext)this.context.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT); + servletContext.removeAttribute(PortalService.ROLE); + } catch (ContextException ignore) { + // we ignore the context exception + } } } Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/pluto/adapter/PortletAdapter.java URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/pluto/adapter/PortletAdapter.java?rev=418569&r1=418568&r2=418569&view=diff ============================================================================== --- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/pluto/adapter/PortletAdapter.java (original) +++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/pluto/adapter/PortletAdapter.java Sun Jul 2 04:03:28 2006 @@ -23,13 +23,10 @@ import javax.portlet.PortletMode; import javax.portlet.PortletRequest; import javax.portlet.WindowState; -import javax.servlet.ServletConfig; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.avalon.framework.container.ContainerUtil; -import org.apache.avalon.framework.context.Context; -import org.apache.avalon.framework.context.ContextException; import org.apache.avalon.framework.parameters.ParameterException; import org.apache.avalon.framework.parameters.Parameterizable; import org.apache.avalon.framework.parameters.Parameters; @@ -56,7 +53,6 @@ import org.apache.cocoon.portal.pluto.servlet.ServletResponseImpl; import org.apache.cocoon.portal.serialization.IncludingHTMLSerializer; import org.apache.cocoon.portal.util.HtmlSaxParser; -import org.apache.cocoon.servlet.CocoonServlet; import org.apache.cocoon.xml.AttributesImpl; import org.apache.pluto.PortletContainer; import org.apache.pluto.PortletContainerException; @@ -85,9 +81,6 @@ extends AbstractCopletAdapter implements PortalManagerAspect, CopletDecorationProvider, Receiver, Parameterizable { - /** The servlet configuration for pluto. */ - protected ServletConfig servletConfig; - /** The Portlet Container. */ protected PortletContainer portletContainer; @@ -98,21 +91,6 @@ protected Parameters parameters; /** - * @see org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context) - */ - public void contextualize(Context context) throws ContextException { - super.contextualize(context); - try { - this.servletConfig = (ServletConfig) context.get(CocoonServlet.CONTEXT_SERVLET_CONFIG); - } catch (ContextException ignore) { - // we ignore the context exception - // this avoids startup errors if the portal is configured for the CLI - // environment - this.getLogger().warn("The JSR-168 support is disabled as the servlet context is not available.", ignore); - } - } - - /** * @see org.apache.avalon.framework.parameters.Parameterizable#parameterize(org.apache.avalon.framework.parameters.Parameters) */ public void parameterize(Parameters params) throws ParameterException { @@ -257,9 +235,7 @@ */ public void initialize() throws Exception { super.initialize(); - if ( this.servletConfig != null ) { - this.initContainer(); - } + this.initContainer(); } /** @@ -297,7 +273,9 @@ Properties properties = new Properties(); try { - portletContainer.init(uniqueContainerName, servletConfig, this.portletContainerEnvironment, properties); + // TODO - Currently it's safe to pass in null as the ServletConfig into Pluto, but we + // should try to provide an object + portletContainer.init(uniqueContainerName, null, this.portletContainerEnvironment, properties); } catch (PortletContainerException exc) { throw new ProcessingException("Initialization of the portlet container failed.", exc); } @@ -350,11 +328,6 @@ throws ProcessingException { // process the events aspectContext.invokeNext(); - - // if we aren't running in a servlet environment, just skip the JSR-168 part - if ( this.servletConfig == null ) { - return; - } // do we already have an environment? // if not, create one Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/pluto/om/PortletDefinitionRegistryImpl.java URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/pluto/om/PortletDefinitionRegistryImpl.java?rev=418569&r1=418568&r2=418569&view=diff ============================================================================== --- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/pluto/om/PortletDefinitionRegistryImpl.java (original) +++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/pluto/om/PortletDefinitionRegistryImpl.java Sun Jul 2 04:03:28 2006 @@ -29,7 +29,6 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipFile; -import javax.servlet.ServletConfig; import javax.servlet.ServletContext; import org.apache.avalon.framework.parameters.ParameterException; @@ -37,6 +36,7 @@ import org.apache.avalon.framework.parameters.Parameters; import org.apache.avalon.framework.service.ServiceException; import org.apache.avalon.framework.service.ServiceManager; +import org.apache.cocoon.Constants; import org.apache.cocoon.components.source.SourceUtil; import org.apache.cocoon.components.thread.RunnableManager; import org.apache.cocoon.portal.PortalComponentManager; @@ -50,7 +50,6 @@ import org.apache.cocoon.portal.impl.AbstractComponent; import org.apache.cocoon.portal.pluto.deployment.Deployer; import org.apache.cocoon.portal.pluto.deployment.WebApplicationRewriter; -import org.apache.cocoon.servlet.CocoonServlet; import org.apache.excalibur.source.Source; import org.apache.excalibur.source.SourceResolver; import org.apache.excalibur.xml.EntityResolver; @@ -125,8 +124,8 @@ /** The threadpool name to be used for daemon thread. */ protected String threadPoolName = "daemon"; - /** The servlet config. */ - protected ServletConfig servletConfig; + /** The servlet context. */ + protected ServletContext servletContext; /** * Default constructor. @@ -183,11 +182,10 @@ } super.initialize(); - this.servletConfig = (ServletConfig) this.context.get(CocoonServlet.CONTEXT_SERVLET_CONFIG); - final ServletContext servletContext = servletConfig.getServletContext(); + this.servletContext = (ServletContext)context.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT); // get our context path - String baseWMDir = servletContext.getRealPath(""); + String baseWMDir = this.servletContext.getRealPath(""); if (baseWMDir != null) { // BEGIN PATCH for IBM WebSphere if (baseWMDir.endsWith(File.separator)) { @@ -198,7 +196,7 @@ this.contextName = baseWMDir.substring(lastIndex + 1); baseWMDir = baseWMDir.substring(0, lastIndex); if (this.getLogger().isDebugEnabled()) { - this.getLogger().debug("servletContext.getRealPath('') =" + servletContext.getRealPath("")); + this.getLogger().debug("servletContext.getRealPath('') =" + this.servletContext.getRealPath("")); this.getLogger().debug("baseWMDir = " + baseWMDir); } } @@ -279,7 +277,7 @@ + "and 'webapp-directory' is not configured."); } this.contextName = "local"; - this.loadLocal(this.servletConfig); + this.loadLocal(); } else { this.scanWebapps(); } @@ -331,19 +329,18 @@ } } - protected void loadLocal(ServletConfig config) + protected void loadLocal() throws Exception { - final ServletContext servletContext = config.getServletContext(); - URL url = servletContext.getResource("/" + PORTLET_XML); + URL url = this.servletContext.getResource("/" + PORTLET_XML); if (url != null) { InputSource portletSource = new InputSource(url.openStream()); portletSource.setSystemId(url.toExternalForm()); - url = servletContext.getResource("/" + WEB_XML); + url = this.servletContext.getResource("/" + WEB_XML); final InputSource webSource = new InputSource(url.openStream()); webSource.setSystemId(url.toExternalForm()); - url = servletContext.getResource("/" + COPLET_XML); + url = this.servletContext.getResource("/" + COPLET_XML); InputSource copletSource = null; if ( url != null ) { copletSource = new InputSource(url.openStream()); Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/pluto/services/factory/FactoryManagerServiceImpl.java URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/pluto/services/factory/FactoryManagerServiceImpl.java?rev=418569&r1=418568&r2=418569&view=diff ============================================================================== --- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/pluto/services/factory/FactoryManagerServiceImpl.java (original) +++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/pluto/services/factory/FactoryManagerServiceImpl.java Sun Jul 2 04:03:28 2006 @@ -17,6 +17,7 @@ import java.util.ArrayList; import java.util.Collections; +import java.util.Enumeration; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -33,6 +34,7 @@ import javax.portlet.RenderRequest; import javax.portlet.RenderResponse; import javax.servlet.ServletConfig; +import javax.servlet.ServletContext; import org.apache.avalon.framework.container.ContainerUtil; import org.apache.avalon.framework.context.Context; @@ -40,6 +42,7 @@ import org.apache.avalon.framework.parameters.ParameterException; import org.apache.avalon.framework.parameters.Parameterizable; import org.apache.avalon.framework.parameters.Parameters; +import org.apache.cocoon.Constants; import org.apache.cocoon.portal.impl.AbstractComponent; import org.apache.cocoon.portal.pluto.factory.ActionRequestFactoryImpl; import org.apache.cocoon.portal.pluto.factory.ControllerFactoryImpl; @@ -47,7 +50,6 @@ import org.apache.cocoon.portal.pluto.factory.PortletInvokerFactoryImpl; import org.apache.cocoon.portal.pluto.factory.PortletPreferencesFactoryImpl; import org.apache.cocoon.portal.pluto.factory.RenderRequestFactoryImpl; -import org.apache.cocoon.servlet.CocoonServlet; import org.apache.cocoon.util.ClassUtils; import org.apache.pluto.factory.Factory; import org.apache.pluto.factory.ObjectIDFactory; @@ -91,11 +93,49 @@ /**< * @see org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context) */ - public void contextualize(Context context) throws ContextException { - super.contextualize(context); - this.servletConfig = (ServletConfig)this.context.get(CocoonServlet.CONTEXT_SERVLET_CONFIG); + public void contextualize(Context aContext) throws ContextException { + super.contextualize(aContext); + final ServletContext servletContext = (ServletContext)aContext.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT); + this.servletConfig = new PortalServletConfig(servletContext); } + protected static final class PortalServletConfig implements ServletConfig { + + private final ServletContext servletContext; + + public PortalServletConfig(ServletContext sContext) { + this.servletContext = sContext; + } + + /** + * @see javax.servlet.ServletConfig#getInitParameter(java.lang.String) + */ + public String getInitParameter(String arg0) { + return this.servletContext.getInitParameter(arg0); + } + + /** + * @see javax.servlet.ServletConfig#getInitParameterNames() + */ + public Enumeration getInitParameterNames() { + return this.servletContext.getInitParameterNames(); + } + + /** + * @see javax.servlet.ServletConfig#getServletContext() + */ + public ServletContext getServletContext() { + return this.servletContext; + } + + /** + * @see javax.servlet.ServletConfig#getServletName() + */ + public String getServletName() { + return this.servletContext.getServletContextName(); + } + + } /** * @see org.apache.avalon.framework.parameters.Parameterizable#parameterize(org.apache.avalon.framework.parameters.Parameters) */ Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/wsrp/adapter/WSRPAdapter.java URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/wsrp/adapter/WSRPAdapter.java?rev=418569&r1=418568&r2=418569&view=diff ============================================================================== --- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/wsrp/adapter/WSRPAdapter.java (original) +++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/wsrp/adapter/WSRPAdapter.java Sun Jul 2 04:03:28 2006 @@ -22,8 +22,6 @@ import java.util.List; import java.util.Map; -import javax.servlet.ServletConfig; - import oasis.names.tc.wsrp.v1.types.BlockingInteractionResponse; import oasis.names.tc.wsrp.v1.types.LocalizedString; import oasis.names.tc.wsrp.v1.types.MarkupContext; @@ -38,8 +36,6 @@ import org.apache.avalon.framework.configuration.ConfigurationException; import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder; import org.apache.avalon.framework.container.ContainerUtil; -import org.apache.avalon.framework.context.Context; -import org.apache.avalon.framework.context.ContextException; import org.apache.avalon.framework.parameters.ParameterException; import org.apache.avalon.framework.parameters.Parameterizable; import org.apache.avalon.framework.parameters.Parameters; @@ -79,7 +75,6 @@ import org.apache.cocoon.portal.wsrp.consumer.WSRPRequestImpl; import org.apache.cocoon.portal.wsrp.logging.WSRPLogManager; import org.apache.cocoon.portal.wsrp.logging.WSRPLogger; -import org.apache.cocoon.servlet.CocoonServlet; import org.apache.cocoon.util.ClassUtils; import org.apache.cocoon.xml.AbstractXMLPipe; import org.apache.cocoon.xml.AttributesImpl; @@ -158,9 +153,6 @@ /** Stores the current coplet instance data per thread. */ protected final ThreadLocal copletInstanceData = new ThreadLocal(); - /** The servlet configuration. */ - protected ServletConfig servletConfig; - /** The user context provider. */ protected UserContextProvider userContextProvider; @@ -175,21 +167,6 @@ /** The configuration for this adapter. */ protected Parameters parameters; - - /** - * @see org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context) - */ - public void contextualize(Context context) throws ContextException { - super.contextualize(context); - try { - this.servletConfig = (ServletConfig) context.get(CocoonServlet.CONTEXT_SERVLET_CONFIG); - } catch (ContextException ignore) { - // we ignore the context exception - // this avoids startup errors if the portal is configured for the CLI - // environment - this.getLogger().warn("The wsrp support is disabled as the servlet context is not available.", ignore); - } - } /** * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager) Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/test/java/org/apache/cocoon/portal/AbstractPortalTestCase.java URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/test/java/org/apache/cocoon/portal/AbstractPortalTestCase.java?rev=418569&r1=418568&r2=418569&view=diff ============================================================================== --- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/test/java/org/apache/cocoon/portal/AbstractPortalTestCase.java (original) +++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/test/java/org/apache/cocoon/portal/AbstractPortalTestCase.java Sun Jul 2 04:03:28 2006 @@ -23,13 +23,11 @@ import org.apache.avalon.framework.configuration.Configuration; import org.apache.avalon.framework.configuration.DefaultConfiguration; -import org.apache.avalon.framework.context.DefaultContext; import org.apache.cocoon.CocoonTestCase; import org.apache.cocoon.core.container.spring.ComponentInfo; import org.apache.cocoon.core.container.spring.ConfigurationInfo; import org.apache.cocoon.environment.mock.MockContext; import org.apache.cocoon.portal.impl.PortalServiceImpl; -import org.apache.cocoon.servlet.CocoonServlet; /** * Abstract test case class that can be used as a base for own portal @@ -69,14 +67,6 @@ rootConfig.addChild(portalConfig); rootConfig.makeReadOnly(); return rootConfig; - } - - /** - * @see org.apache.cocoon.core.container.ContainerTestCase#addContext(org.apache.avalon.framework.context.DefaultContext) - */ - protected void addContext(DefaultContext context) { - super.addContext(context); - context.put(CocoonServlet.CONTEXT_SERVLET_CONFIG, this.getServletConfig()); } /** Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/Constants.java URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/Constants.java?rev=418569&r1=418568&r2=418569&view=diff ============================================================================== --- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/Constants.java (original) +++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/Constants.java Sun Jul 2 04:03:28 2006 @@ -178,7 +178,7 @@ /** The namespace prefix for the Error/Exception XML */ public static final String ERROR_NAMESPACE_PREFIX = "error"; - /** Application <code>Context</code> Key for the environmental Context */ + /** Application <code>Context</code> Key for the environmental Context (= ServletContext) */ public static final String CONTEXT_ENVIRONMENT_CONTEXT = "environment-context"; /** Application <code>Context</code> Key for the work directory path */ Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/ProcessingUtil.java URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/ProcessingUtil.java?rev=418569&r1=418568&r2=418569&view=diff ============================================================================== --- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/ProcessingUtil.java (original) +++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/ProcessingUtil.java Sun Jul 2 04:03:28 2006 @@ -22,7 +22,6 @@ import java.util.Map; import org.apache.avalon.framework.service.ServiceManager; -import org.apache.cocoon.core.Settings; import org.apache.cocoon.environment.internal.EnvironmentHelper; import org.apache.excalibur.source.SourceResolver; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; @@ -42,9 +41,6 @@ /** Bean name for the logger. */ public static final String LOGGER_ROLE = "org.apache.avalon.framework.logger.Logger"; - - /** Bean name for the settings. */ - public static final String SETTINGS_ROLE = Settings.class.getName(); /** Bean name for the service manager. */ public static final String SERVICE_MANAGER_ROLE = "org.apache.avalon.framework.service.ServiceManager"; Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/modules/input/SettingsInputModule.java URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/modules/input/SettingsInputModule.java?rev=418569&r1=418568&r2=418569&view=diff ============================================================================== --- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/modules/input/SettingsInputModule.java (original) +++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/modules/input/SettingsInputModule.java Sun Jul 2 04:03:28 2006 @@ -22,7 +22,6 @@ import org.apache.avalon.framework.configuration.ConfigurationException; import org.apache.avalon.framework.logger.AbstractLogEnabled; import org.apache.avalon.framework.thread.ThreadSafe; -import org.apache.cocoon.ProcessingUtil; import org.apache.cocoon.core.Settings; import org.apache.cocoon.environment.internal.EnvironmentHelper; import org.apache.commons.collections.IteratorUtils; @@ -44,7 +43,7 @@ */ public Object getAttribute(String name, Configuration modeConf, Map objectModel) throws ConfigurationException { - final Settings settings = (Settings)EnvironmentHelper.getCurrentProcessor().getBeanFactory().getBean(ProcessingUtil.SETTINGS_ROLE); + final Settings settings = (Settings)EnvironmentHelper.getCurrentProcessor().getBeanFactory().getBean(Settings.ROLE); if ( settings != null ) { return settings.getProperty(name); } Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/source/impl/ContextSourceFactory.java URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/source/impl/ContextSourceFactory.java?rev=418569&r1=418568&r2=418569&view=diff ============================================================================== --- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/source/impl/ContextSourceFactory.java (original) +++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/source/impl/ContextSourceFactory.java Sun Jul 2 04:03:28 2006 @@ -22,7 +22,6 @@ import java.util.Map; import java.util.Set; -import javax.servlet.ServletConfig; import javax.servlet.ServletContext; import org.apache.avalon.framework.context.ContextException; @@ -34,7 +33,6 @@ import org.apache.avalon.framework.thread.ThreadSafe; import org.apache.cocoon.Constants; import org.apache.cocoon.environment.Context; -import org.apache.cocoon.servlet.CocoonServlet; import org.apache.commons.lang.BooleanUtils; import org.apache.excalibur.source.Source; import org.apache.excalibur.source.SourceException; @@ -60,9 +58,6 @@ ThreadSafe, URIAbsolutizer { - /** The context */ - protected Context envContext; - /** The ServiceManager */ protected ServiceManager manager; @@ -81,12 +76,7 @@ */ public void contextualize(org.apache.avalon.framework.context.Context context) throws ContextException { - this.envContext = (Context) context.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT); - try { - this.servletContext = ((ServletConfig) context.get(CocoonServlet.CONTEXT_SERVLET_CONFIG)).getServletContext(); - } catch (ContextException ignore) { - // in other environments (CLI etc.), we don't have a servlet context - } + this.servletContext = (Context) context.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT); } /** @@ -116,11 +106,11 @@ URL u; // Try to get a file first and fall back to a resource URL - String actualPath = envContext.getRealPath(path); + String actualPath = this.servletContext.getRealPath(path); if (actualPath != null) { u = new File(actualPath).toURL(); } else { - u = envContext.getResource(path); + u = this.servletContext.getResource(path); } if (u != null) { Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelineNodeBuilder.java URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelineNodeBuilder.java?rev=418569&r1=418568&r2=418569&view=diff ============================================================================== --- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelineNodeBuilder.java (original) +++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelineNodeBuilder.java Sun Jul 2 04:03:28 2006 @@ -20,7 +20,6 @@ import org.apache.avalon.framework.configuration.Configuration; import org.apache.avalon.framework.configuration.ConfigurationException; -import org.apache.cocoon.ProcessingUtil; import org.apache.cocoon.components.pipeline.ProcessingPipeline; import org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNodeBuilder; import org.apache.cocoon.components.treeprocessor.ProcessingNode; @@ -49,7 +48,7 @@ super.setBuilder(treeBuilder); // check ssettings for ignoring of internal only pipeline flags this.ignoreInternalOnly = false; - final Settings settings = (Settings)treeBuilder.getBeanFactory().getBean(ProcessingUtil.SETTINGS_ROLE); + final Settings settings = (Settings)treeBuilder.getBeanFactory().getBean(Settings.ROLE); final String value = settings.getProperty(PipelineNodeBuilder.PROPERTY_SITEMAP_INTERNALONLY); if ( value != null ) { this.ignoreInternalOnly = Boolean.valueOf(value).booleanValue(); Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/SitemapLanguage.java URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/SitemapLanguage.java?rev=418569&r1=418568&r2=418569&view=diff ============================================================================== --- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/SitemapLanguage.java (original) +++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/SitemapLanguage.java Sun Jul 2 04:03:28 2006 @@ -76,7 +76,6 @@ import org.apache.cocoon.sitemap.LeaveSitemapEventListener; import org.apache.cocoon.sitemap.PatternException; import org.apache.cocoon.sitemap.SitemapParameters; -import org.apache.cocoon.util.ClassUtils; import org.apache.cocoon.util.Deprecation; import org.apache.cocoon.util.location.Location; import org.apache.cocoon.util.location.LocationImpl; @@ -399,10 +398,10 @@ factory.setBeanFactory(this.beanFactory); // check for sitemap local properties - Settings settings = (Settings)factory.getCurrentBeanFactory(itsContext).getBean(ProcessingUtil.SETTINGS_ROLE); + Settings settings = (Settings)factory.getCurrentBeanFactory(itsContext).getBean(Settings.ROLE); if ( componentConfig != null && componentConfig.getAttribute("property-dir", null) != null ) { final String propertyDir = componentConfig.getAttribute("property-dir"); - settings = this.createSettings(settings, propertyDir, useDefaultIncludes); + settings = this.createSettings(settings, propertyDir, useDefaultIncludes, factory.getCurrentBeanFactory(itsContext)); } // compatibility with 2.1.x - check for global variables in sitemap // TODO - This will be removed in later versions! @@ -1152,7 +1151,8 @@ */ protected MutableSettings createSettings(Settings parent, String directory, - boolean useDefaultIncludes) { + boolean useDefaultIncludes, + BeanFactory parentBeanFactory) { // get the running mode final String mode = System.getProperty(Settings.PROPERTY_RUNNING_MODE, Settings.DEFAULT_RUNNING_MODE); @@ -1171,15 +1171,15 @@ // read all properties from the mode dependent directory this.readProperties(directory + '/' + mode, s); - // Next look for custom property providers - Iterator i = s.getPropertyProviders().iterator(); - while ( i.hasNext() ) { - final String className = (String)i.next(); + // Next look for a custom property provider in the parent bean factory + if (parentBeanFactory != null && parentBeanFactory.containsBean(PropertyProvider.ROLE) ) { try { - PropertyProvider provider = (PropertyProvider)ClassUtils.newInstance(className); - s.fill(provider.getProperties()); + final Environment env = EnvironmentHelper.getCurrentEnvironment(); + PropertyProvider provider = (PropertyProvider)parentBeanFactory.getBean(PropertyProvider.ROLE); + // TODO - add the name of the sitemap file to the path + s.fill(provider.getProperties(env.getURIPrefix())); } catch (Exception ignore) { - this.getLogger().warn("Unable to get property provider for class " + className, ignore); + this.getLogger().warn("Unable to get properties from provider.", ignore); this.getLogger().warn("Continuing initialization."); } } Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/BaseSettings.java URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/BaseSettings.java?rev=418569&r1=418568&r2=418569&view=diff ============================================================================== --- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/BaseSettings.java (original) +++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/BaseSettings.java Sun Jul 2 04:03:28 2006 @@ -43,9 +43,6 @@ /** This parameter specifies the class for the root processor */ String KEY_PROCESSOR_CLASS = "processor"; - /** The default root processor */ - String DEFAULT_PROCESSOR_CLASS = "org.apache.cocoon.Cocoon"; - /** * This parameter points to the main configuration file for Cocoon. * Note that the path is specified in absolute notation but it will be @@ -125,6 +122,15 @@ String KEY_FORM_ENCODING = "formencoding"; /** + * Set encoding used by the container. If not set the ISO-8859-1 encoding + * will be assumed. + * Since the servlet specification requires that the ISO-8859-1 encoding + * is used (by default), you should never change this value unless + * you have a buggy servlet container. + */ + String KEY_CONTAINER_ENCODING = "containerencoding"; + + /** * If this value is specified, it will be interpreted as a log level and * all logging categories will be set to this level regardless of their * definition in the logging configuration. @@ -132,17 +138,6 @@ String KEY_LOGGING_OVERRIDE_LOGLEVEL = "override.loglevel"; /** - * This key allows to add own {@link PropertyProvider}s. - */ - String KEY_PROPERTY_PROVIDER = "property.provider"; - - /** - * @return Returns the class for the root processor - * @see #KEY_PROCESSOR_CLASS - */ - String getProcessorClassName(); - - /** * @return Returns the configuration. * @see #KEY_CONFIGURATION */ @@ -197,6 +192,12 @@ String getFormEncoding(); /** + * @return Returns the container encoding + * @see #KEY_CONTAINER_ENCODING + */ + String getContainerEncoding(); + + /** * @return Returns the manageExceptions. * @see #KEY_MANAGE_EXCEPTIONS */ @@ -218,10 +219,4 @@ * The creation time of the current Cocoon instance. */ long getCreationTime(); - - /** - * @return All property providers. - * @see #KEY_PROPERTY_PROVIDER - */ - List getPropertyProviders(); } Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/CoreUtil.java URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/CoreUtil.java?rev=418569&r1=418568&r2=418569&view=diff ============================================================================== --- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/CoreUtil.java (original) +++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/CoreUtil.java Sun Jul 2 04:03:28 2006 @@ -60,6 +60,7 @@ import org.apache.excalibur.source.SourceResolver; import org.apache.excalibur.source.TraversableSource; import org.apache.excalibur.source.impl.URLSource; +import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.xml.sax.InputSource; @@ -282,8 +283,10 @@ settings.setCacheDirectory(cacheDir.getAbsolutePath()); } - public static DefaultContext createContext(Settings settings, Context environmentContext, - String contextUrl, ClassLoader classLoader, BootstrapEnvironment env) + public static DefaultContext createContext(Settings settings, + Context environmentContext, + String contextUrl, + BootstrapEnvironment env) throws ServletException, MalformedURLException { DefaultContext appContext = new ComponentContext(); CoreUtil.addSourceResolverContext(appContext, environmentContext, env, contextUrl); @@ -298,14 +301,17 @@ * @param env optional bootstrap context * @param contextUrl URL for the context */ - private static void addSourceResolverContext(DefaultContext appContext, Context environmentContext, BootstrapEnvironment env, String contextUrl) { + private static void addSourceResolverContext(DefaultContext appContext, + Context environmentContext, + BootstrapEnvironment env, + String contextUrl) { try { appContext.put(ContextHelper.CONTEXT_ROOT_URL, new URL(contextUrl)); } catch (MalformedURLException ignore) { // we simply ignore this } - // add environment context + // add environment context and config appContext.put(Constants.CONTEXT_ENVIRONMENT_CONTEXT, environmentContext); // now add environment specific information @@ -377,15 +383,14 @@ // read all properties from the mode dependent directory this.readProperties("context://WEB-INF/properties/" + mode, s, resolver); - // Next look for custom property providers - Iterator i = s.getPropertyProviders().iterator(); - while ( i.hasNext() ) { - final String className = (String)i.next(); + // Next look for a custom property provider in the spring root context + BeanFactory rootContext = BeanFactoryUtil.getWebApplicationContext(environmentContext); + if (rootContext != null && rootContext.containsBean(PropertyProvider.ROLE) ) { try { - PropertyProvider provider = (PropertyProvider)ClassUtils.newInstance(className); - s.fill(provider.getProperties()); + PropertyProvider provider = (PropertyProvider)rootContext.getBean(PropertyProvider.ROLE); + s.fill(provider.getProperties(null)); } catch (Exception ignore) { - this.environmentContext.log("Unable to get property provider for class " + className, ignore); + this.environmentContext.log("Unable to get properties from provider.", ignore); this.environmentContext.log("Continuing initialization."); } } Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/MutableSettings.java URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/MutableSettings.java?rev=418569&r1=418568&r2=418569&view=diff ============================================================================== --- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/MutableSettings.java (original) +++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/MutableSettings.java Sun Jul 2 04:03:28 2006 @@ -42,11 +42,6 @@ protected final List properties = new ArrayList(); /** - * This parameter indicates what class to use for the root processor. - */ - protected String processorClassName; - - /** * This parameter points to the main configuration file for Cocoon. * Note that the path is specified in absolute notation but it will be * resolved relative to the application context path. @@ -185,8 +180,10 @@ /** The time the cocoon instance was created. */ protected Long creationTime; - /** The property providers. */ - protected final List propertyProviders = new ArrayList(); + /** The container encoding. + * @see BaseSettings#KEY_CONTAINER_ENCODING + */ + protected String containerEncoding; /** The optional parent settings object. */ protected Settings parent; @@ -196,7 +193,6 @@ */ public MutableSettings() { // set default values - this.processorClassName = DEFAULT_PROCESSOR_CLASS; this.reloadingEnabled = BooleanUtils.toBooleanObject(RELOADING_ENABLED_DEFAULT); this.enableUploads = BooleanUtils.toBooleanObject(ENABLE_UPLOADS); this.autosaveUploads = BooleanUtils.toBooleanObject(SAVE_UPLOADS_TO_DISK); @@ -206,6 +202,7 @@ this.showCocoonVersion = BooleanUtils.toBooleanObject(SHOW_COCOON_VERSION); this.manageExceptions = BooleanUtils.toBooleanObject(MANAGE_EXCEPTIONS); this.configurationReloadDelay = new Long(1000); + this.containerEncoding = "ISO-8859-1"; } public MutableSettings(Settings parent) { @@ -226,9 +223,7 @@ key = key.substring(KEYPREFIX.length()); final String value = current.getValue().toString(); - if ( key.equals(KEY_PROCESSOR_CLASS) ) { - this.processorClassName = value; - } else if ( key.equals(KEY_CONFIGURATION) ) { + if ( key.equals(KEY_CONFIGURATION) ) { this.configuration = value; } else if ( key.equals(KEY_RELOAD_DELAY) ) { this.configurationReloadDelay = Long.valueOf(value); @@ -270,8 +265,8 @@ this.overrideLogLevel = value; } else if ( key.startsWith(KEY_LOAD_CLASSES) ) { this.addToLoadClasses(value); - } else if ( key.startsWith(KEY_PROPERTY_PROVIDER) ) { - this.addToPropertyProviders(value); + } else if ( key.startsWith(KEY_CONTAINER_ENCODING ) ) { + this.containerEncoding = value; } } } @@ -358,16 +353,6 @@ } /** - * @see org.apache.cocoon.core.BaseSettings#getProcessorClassName() - */ - public String getProcessorClassName() { - if ( this.processorClassName == null && this.parent != null ) { - return this.parent.getProcessorClassName(); - } - return this.processorClassName; - } - - /** * @see org.apache.cocoon.core.BaseSettings#getConfiguration() */ public String getConfiguration() { @@ -401,6 +386,24 @@ } /** + * @see org.apache.cocoon.core.BaseSettings#getContainerEncoding() + */ + public String getContainerEncoding() { + if ( this.containerEncoding == null && this.parent != null ) { + return this.parent.getContainerEncoding(); + } + return this.containerEncoding; + } + + /** + * Set the container encoding. + * @param value The new encoding value. + */ + public void setContainerEncoding(String value) { + this.containerEncoding = value; + } + + /** * @see org.apache.cocoon.core.BaseSettings#getLoadClasses() */ public List getLoadClasses() { @@ -609,9 +612,7 @@ String value = null; if ( key.startsWith(KEYPREFIX) ) { final String sKey = key.substring(KEYPREFIX.length()); - if ( sKey.equals(KEY_PROCESSOR_CLASS) ) { - value = this.getProcessorClassName(); - } else if ( sKey.equals(KEY_CONFIGURATION) ) { + if ( sKey.equals(KEY_CONFIGURATION) ) { value = this.getConfiguration(); } else if ( sKey.equals(KEY_RELOAD_DELAY) ) { value = String.valueOf(this.getReloadDelay(null)); @@ -651,8 +652,8 @@ value = this.getOverrideLogLevel(); } else if ( key.equals(KEY_LOAD_CLASSES) ) { value = this.toString(this.getLoadClasses()); - } else if ( key.equals(KEY_PROPERTY_PROVIDER) ) { - value = this.toString(this.getPropertyProviders()); + } else if ( key.equals(KEY_CONTAINER_ENCODING) ) { + value = this.containerEncoding; } } @@ -678,7 +679,6 @@ public String toString() { return "Settings:\n" + "Running mode : " + this.getProperty(PROPERTY_RUNNING_MODE, DEFAULT_RUNNING_MODE) + '\n' + - KEY_PROCESSOR_CLASS + " : " + this.processorClassName + '\n' + KEY_CONFIGURATION + " : " + this.configuration + '\n' + KEY_RELOAD_DELAY + " : " + this.configurationReloadDelay + '\n' + KEY_RELOADING + " : " + this.reloadingEnabled + '\n' + @@ -697,6 +697,7 @@ KEY_CACHE_DIRECTORY + " : " + this.cacheDirectory + '\n' + KEY_WORK_DIRECTORY + " : " + this.workDirectory + '\n' + KEY_FORM_ENCODING + " : " + this.formEncoding + '\n' + + KEY_CONTAINER_ENCODING + " : " + this.containerEncoding + '\n' + KEY_SHOWTIME + " : " + this.showTime + '\n' + KEY_HIDE_SHOWTIME + " : " + this.hideShowTime + '\n' + KEY_SHOW_VERSION + " : " + this.showCocoonVersion + '\n'; @@ -739,9 +740,9 @@ /** * @param autosaveUploads The autosaveUploads to set. */ - public void setAutosaveUploads(boolean autosaveUploads) { + public void setAutosaveUploads(boolean autosaveUploadsValue) { this.checkWriteable(); - this.autosaveUploads = BooleanUtils.toBooleanObject(autosaveUploads); + this.autosaveUploads = BooleanUtils.toBooleanObject(autosaveUploadsValue); } /** @@ -753,14 +754,6 @@ } /** - * @param processorClassName The processorClassName to set. - */ - public void setProcessorClassName(String processorClassName) { - this.checkWriteable(); - this.processorClassName = processorClassName; - } - - /** * @param cocoonLogger The cocoonLogger to set. */ public void setCocoonLogger(String cocoonLogger) { @@ -936,22 +929,6 @@ // Don't check read only here as this will change if Cocoon // is reloaded while the settings remain the same. this.creationTime = new Long(value); - } - - /** - * @see org.apache.cocoon.core.BaseSettings#getPropertyProviders() - */ - public List getPropertyProviders() { - // we don't ask the parent here - return this.propertyProviders; - } - - /** - * Add a property provider. - */ - public void addToPropertyProviders(String className) { - this.checkWriteable(); - this.propertyProviders.add(className); } /** Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/PropertyProvider.java URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/PropertyProvider.java?rev=418569&r1=418568&r2=418569&view=diff ============================================================================== --- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/PropertyProvider.java (original) +++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/PropertyProvider.java Sun Jul 2 04:03:28 2006 @@ -21,11 +21,15 @@ /** * This is an interface for custom components delivering properties to * configure Cocoon. + * This component must be setup as a Spring bean in the root application + * context. * * @version $Id$ * @since 2.2 */ public interface PropertyProvider { - Properties getProperties(); + String ROLE = PropertyProvider.class.getName(); + + Properties getProperties(String path); } Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/BeanFactoryUtil.java URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/BeanFactoryUtil.java?rev=418569&r1=418568&r2=418569&view=diff ============================================================================== --- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/BeanFactoryUtil.java (original) +++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/BeanFactoryUtil.java Sun Jul 2 04:03:28 2006 @@ -161,7 +161,7 @@ factory.registerSingleton(SourceResolver.ROLE + "/Local", resolver); } // add local settings - factory.registerSingleton(ProcessingUtil.SETTINGS_ROLE, env.settings); + factory.registerSingleton(Settings.ROLE, env.settings); prepareBeanFactory(factory, info); if (preInstantiateSingletons) { factory.preInstantiateSingletons(); @@ -185,16 +185,24 @@ public static ConfigurableListableBeanFactory createRootBeanFactory(AvalonEnvironment env, ServletContext servletContext) throws Exception { - ApplicationContext parent = null; - if( servletContext != null) { - parent = (ApplicationContext)servletContext.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE); - } + ApplicationContext parent = getWebApplicationContext(servletContext); CocoonBeanFactory factory = new CocoonBeanFactory(parent); factory.registerSingleton(ProcessingUtil.CONTEXT_ROLE, env.context); factory.registerSingleton(ProcessingUtil.LOGGER_ROLE, env.logger); - factory.registerSingleton(ProcessingUtil.SETTINGS_ROLE, env.settings); + factory.registerSingleton(Settings.ROLE, env.settings); factory.preInstantiateSingletons(); return factory; + } + + /** + * Get a possible root context. + */ + public static ApplicationContext getWebApplicationContext(ServletContext servletContext) { + ApplicationContext parent = null; + if( servletContext != null) { + parent = (ApplicationContext)servletContext.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE); + } + return parent; } /** Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/osgi/OSGiSpringECMFactory.java URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/osgi/OSGiSpringECMFactory.java?rev=418569&r1=418568&r2=418569&view=diff ============================================================================== --- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/osgi/OSGiSpringECMFactory.java (original) +++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/osgi/OSGiSpringECMFactory.java Sun Jul 2 04:03:28 2006 @@ -109,7 +109,7 @@ this.logger = (Logger) this.parentBeanfactory.getBean(ProcessingUtil.LOGGER_ROLE); } if (this.settings == null && this.parentBeanfactory != null) { - this.settings = (Settings) this.parentBeanfactory.getBean(ProcessingUtil.SETTINGS_ROLE); + this.settings = (Settings) this.parentBeanfactory.getBean(Settings.ROLE); } // create a minimal OSGi servlet context @@ -148,7 +148,7 @@ this.logger.debug("Context path: " + contextPath); // create a minimal Avalon Context - DefaultContext avalonContext = CoreUtil.createContext(this.settings, osgiServletContext, contextPath, null, null); + DefaultContext avalonContext = CoreUtil.createContext(this.settings, osgiServletContext, contextPath, null); // create an Avalon environment (it's some kind of container for Avalon related information) AvalonEnvironment avalonEnvironment = new AvalonEnvironment(); Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/generation/StatusGenerator.java URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/generation/StatusGenerator.java?rev=418569&r1=418568&r2=418569&view=diff ============================================================================== --- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/generation/StatusGenerator.java (original) +++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/generation/StatusGenerator.java Sun Jul 2 04:03:28 2006 @@ -456,7 +456,6 @@ Settings.DEFAULT_RUNNING_MODE)); this.addValue(Settings.KEY_CONFIGURATION, s.getConfiguration()); this.addMultilineValue(Settings.KEY_LOAD_CLASSES, s.getLoadClasses()); - this.addValue(Settings.KEY_PROPERTY_PROVIDER, s.getPropertyProviders()); this.addValue(Settings.KEY_LOGGING_CONFIGURATION, s.getLoggingConfiguration()); this.addValue(Settings.KEY_LOGGING_BOOTSTRAP_LOGLEVEL, s.getBootstrapLogLevel()); this.addValue(Settings.KEY_LOGGING_COCOON_LOGGER, s.getCocoonLogger()); @@ -467,6 +466,7 @@ this.addValue(Settings.KEY_CACHE_DIRECTORY, s.getCacheDirectory()); this.addValue(Settings.KEY_WORK_DIRECTORY, s.getWorkDirectory()); this.addValue(Settings.KEY_FORM_ENCODING, s.getFormEncoding()); + this.addValue(Settings.KEY_CONTAINER_ENCODING, s.getContainerEncoding()); this.endGroup(); Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/CocoonServlet.java URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/CocoonServlet.java?rev=418569&r1=418568&r2=418569&view=diff ============================================================================== --- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/CocoonServlet.java (original) +++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/CocoonServlet.java Sun Jul 2 04:03:28 2006 @@ -55,12 +55,6 @@ */ public class CocoonServlet extends HttpServlet { - /** - * Application <code>Context</code> Key for the servlet configuration - * @since 2.1.3 - */ - public static final String CONTEXT_SERVLET_CONFIG = "servlet-config"; - // Processing time message protected static final String PROCESSED_BY = "Processed by " + Constants.COMPLETE_NAME + " in "; @@ -535,8 +529,6 @@ * @see org.apache.cocoon.core.BootstrapEnvironment#configure(org.apache.cocoon.core.MutableSettings) */ public void configure(MutableSettings settings) { - // fill from the servlet parameters - SettingsHelper.fill(settings, this.config); if ( settings.getWorkDirectory() == null ) { final File workDir = (File)this.config.getServletContext().getAttribute("javax.servlet.context.tempdir"); settings.setWorkDirectory(workDir.getAbsolutePath()); @@ -550,7 +542,7 @@ * @see org.apache.cocoon.core.BootstrapEnvironment#configure(org.apache.avalon.framework.context.DefaultContext) */ public void configure(DefaultContext context) { - context.put(CONTEXT_SERVLET_CONFIG, this.config); + // do nothing } } } Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/CocoonServletListener.java URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/CocoonServletListener.java?rev=418569&r1=418568&r2=418569&view=diff ============================================================================== --- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/CocoonServletListener.java (original) +++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/CocoonServletListener.java Sun Jul 2 04:03:28 2006 @@ -90,8 +90,6 @@ * @see org.apache.cocoon.core.BootstrapEnvironment#configure(org.apache.cocoon.core.MutableSettings) */ public void configure(MutableSettings settings) { - // fill from the servlet parameters - SettingsHelper.fill(settings, this.context); if ( settings.getWorkDirectory() == null ) { final File workDir = (File)context.getAttribute("javax.servlet.context.tempdir"); settings.setWorkDirectory(workDir.getAbsolutePath()); @@ -104,7 +102,7 @@ /** * @see org.apache.cocoon.core.BootstrapEnvironment#configure(org.apache.avalon.framework.context.DefaultContext) */ - public void configure(DefaultContext context) { + public void configure(DefaultContext componentContext) { // nothing to do } } Added: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/DebugFilter.java URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/DebugFilter.java?rev=418569&view=auto ============================================================================== --- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/DebugFilter.java (added) +++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/DebugFilter.java Sun Jul 2 04:03:28 2006 @@ -0,0 +1,172 @@ +/* + * Copyright 2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.cocoon.servlet; + +import java.io.IOException; +import java.util.Enumeration; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; + +import org.apache.avalon.framework.logger.Logger; +import org.apache.cocoon.ProcessingUtil; +import org.apache.commons.lang.SystemUtils; +import org.springframework.beans.factory.BeanFactory; + +/** + * Servlet filter for handling multi part MIME uploads + * + * @version $Id$ + */ +public class DebugFilter implements Filter{ + + final static protected String lineSeparator = SystemUtils.LINE_SEPARATOR; + + /** Active request count. */ + private volatile int activeRequestCount; + + /** The logger. */ + protected Logger logger; + + /** + * @see javax.servlet.Filter#init(javax.servlet.FilterConfig) + */ + public void init(FilterConfig config) throws ServletException { + BeanFactory cocoonBeanFactory = (BeanFactory) config.getServletContext().getAttribute(ProcessingUtil.CONTAINER_CONTEXT_ATTR_NAME); + this.logger = (Logger) cocoonBeanFactory.getBean(ProcessingUtil.LOGGER_ROLE); + } + + /** + * @see javax.servlet.Filter#destroy() + */ + public void destroy() { + // nothing to do here + } + + /** + * Log debug information about the current environment. + * @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain) + */ + public void doFilter(ServletRequest req, ServletResponse res, FilterChain filterChain) + throws IOException, ServletException { + // we don't do debug msgs if this is not a http servlet request + if ( ! (req instanceof HttpServletRequest) ) { + filterChain.doFilter(req, res); + return; + } + try { + ++activeRequestCount; + + final HttpServletRequest request = (HttpServletRequest)req; + final HttpSession session = ((HttpServletRequest)req).getSession(false); + final StringBuffer msg = new StringBuffer(); + msg.append("DEBUGGING INFORMATION:").append(lineSeparator); + msg.append("REQUEST: ").append(request.getRequestURI()).append(lineSeparator).append( + lineSeparator); + msg.append("CONTEXT PATH: ").append(request.getContextPath()).append(lineSeparator); + msg.append("SERVLET PATH: ").append(request.getServletPath()).append(lineSeparator); + msg.append("PATH INFO: ").append(request.getPathInfo()).append(lineSeparator).append( + lineSeparator); + + msg.append("REMOTE HOST: ").append(request.getRemoteHost()).append(lineSeparator); + msg.append("REMOTE ADDRESS: ").append(request.getRemoteAddr()).append(lineSeparator); + msg.append("REMOTE USER: ").append(request.getRemoteUser()).append(lineSeparator); + msg.append("REQUEST SESSION ID: ").append(request.getRequestedSessionId()).append( + lineSeparator); + msg.append("REQUEST PREFERRED LOCALE: ").append(request.getLocale().toString()).append( + lineSeparator); + msg.append("SERVER HOST: ").append(request.getServerName()).append(lineSeparator); + msg.append("SERVER PORT: ").append(request.getServerPort()).append(lineSeparator).append( + lineSeparator); + + msg.append("METHOD: ").append(request.getMethod()).append(lineSeparator); + msg.append("CONTENT LENGTH: ").append(request.getContentLength()).append(lineSeparator); + msg.append("PROTOCOL: ").append(request.getProtocol()).append(lineSeparator); + msg.append("SCHEME: ").append(request.getScheme()).append(lineSeparator); + msg.append("AUTH TYPE: ").append(request.getAuthType()).append(lineSeparator).append( + lineSeparator); + msg.append("CURRENT ACTIVE REQUESTS: ").append(activeRequestCount).append(lineSeparator); + + // log all of the request parameters + final Enumeration e = request.getParameterNames(); + + msg.append("REQUEST PARAMETERS:").append(lineSeparator).append(lineSeparator); + + while (e.hasMoreElements()) { + String p = (String) e.nextElement(); + + msg.append("PARAM: '").append(p).append("' ").append("VALUES: '"); + String[] params = request.getParameterValues(p); + for (int i = 0; i < params.length; i++) { + msg.append("[" + params[i] + "]"); + if (i != (params.length - 1)) { + msg.append(", "); + } + } + + msg.append("'").append(lineSeparator); + } + + // log all of the header parameters + final Enumeration e2 = request.getHeaderNames(); + + msg.append("HEADER PARAMETERS:").append(lineSeparator).append(lineSeparator); + + while (e2.hasMoreElements()) { + String p = (String) e2.nextElement(); + + msg.append("PARAM: '").append(p).append("' ").append("VALUES: '"); + Enumeration e3 = request.getHeaders(p); + while (e3.hasMoreElements()) { + msg.append("[" + e3.nextElement() + "]"); + if (e3.hasMoreElements()) { + msg.append(", "); + } + } + + msg.append("'").append(lineSeparator); + } + + msg.append(lineSeparator).append("SESSION ATTRIBUTES:").append(lineSeparator).append( + lineSeparator); + + // log all of the session attributes + if (session != null) { + // Fix bug #12139: Session can be modified while still + // being enumerated here + synchronized (session) { + final Enumeration se = session.getAttributeNames(); + while (se.hasMoreElements()) { + String p = (String) se.nextElement(); + msg.append("PARAM: '").append(p).append("' ").append("VALUE: '").append( + session.getAttribute(p)).append("'").append(lineSeparator); + } + } + } + + this.logger.debug(msg.toString()); + filterChain.doFilter(request, res); + } finally { + --activeRequestCount; + } + } +} Propchange: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/DebugFilter.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/DebugFilter.java ------------------------------------------------------------------------------ svn:keywords = Id Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/RequestProcessor.java URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/RequestProcessor.java?rev=418569&r1=418568&r2=418569&view=diff ============================================================================== --- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/RequestProcessor.java (original) +++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/RequestProcessor.java Sun Jul 2 04:03:28 2006 @@ -29,6 +29,7 @@ import org.apache.cocoon.Constants; import org.apache.cocoon.ProcessingUtil; import org.apache.cocoon.Processor; +import org.apache.cocoon.RequestListener; import org.apache.cocoon.ResourceNotFoundException; import org.apache.cocoon.components.notification.DefaultNotifyingBuilder; import org.apache.cocoon.components.notification.Notifier; @@ -44,8 +45,6 @@ /** * This is the entry point for Cocoon execution as an HTTP Servlet. - * TODO - Move container encoding to properties - * - Remove support for settings config from web.xml * * @version $Id$ */ @@ -79,11 +78,17 @@ /** The root processor. */ protected final Processor rootProcessor; + /** + * An optional component that is called before and after processing all + * requests. + */ + protected RequestListener requestListener; + public RequestProcessor(ServletContext servletContext) { this.servletContext = servletContext; this.cocoonBeanFactory = (BeanFactory) servletContext.getAttribute(ProcessingUtil.CONTAINER_CONTEXT_ATTR_NAME); - this.settings = (Settings) this.cocoonBeanFactory.getBean(ProcessingUtil.SETTINGS_ROLE); - final String encoding = this.servletContext.getInitParameter("container-encoding"); + this.settings = (Settings) this.cocoonBeanFactory.getBean(Settings.ROLE); + final String encoding = this.settings.getContainerEncoding(); if ( encoding == null ) { this.containerEncoding = "ISO-8859-1"; } else { @@ -92,6 +97,10 @@ this.log = (Logger) this.cocoonBeanFactory.getBean(ProcessingUtil.LOGGER_ROLE); this.rootProcessor = (Processor)this.cocoonBeanFactory.getBean(Processor.ROLE); this.environmentContext = new HttpContext(this.servletContext); + // get the optional request listener + if (this.cocoonBeanFactory.containsBean(RequestListener.ROLE)) { + this.requestListener = (RequestListener) this.cocoonBeanFactory.getBean(RequestListener.ROLE); + } } /** @@ -371,13 +380,38 @@ try { boolean result; + if (this.requestListener != null) { + try { + requestListener.onRequestStart(environment); + } catch (Exception e) { + this.log.error("Error encountered monitoring request start: " + + e.getMessage()); + } + } result = this.rootProcessor.process(environment); + if (this.requestListener != null) { + try { + requestListener.onRequestEnd(environment); + } catch (Exception e) { + this.log.error("Error encountered monitoring request start: " + + e.getMessage()); + } + } + // commit response on success environment.commitResponse(); return result; } catch (Exception any) { + if (this.requestListener != null) { + try { + requestListener.onRequestException(environment, any); + } catch (Exception e) { + this.log.error("Error encountered monitoring request start: " + + e.getMessage()); + } + } // reset response on error environment.tryResetResponse(); throw any; Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/multipart/MultipartFilter.java URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/multipart/MultipartFilter.java?rev=418569&r1=418568&r2=418569&view=diff ============================================================================== --- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/multipart/MultipartFilter.java (original) +++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/multipart/MultipartFilter.java Sun Jul 2 04:03:28 2006 @@ -60,15 +60,15 @@ /** The root settings. */ protected Settings settings; - /* (non-Javadoc) + /** * @see javax.servlet.Filter#init(javax.servlet.FilterConfig) */ public void init(FilterConfig config) throws ServletException { String containerEncoding; ServletContext servletContext = config.getServletContext(); this.cocoonBeanFactory = (BeanFactory) servletContext.getAttribute(ProcessingUtil.CONTAINER_CONTEXT_ATTR_NAME); - this.settings = (Settings) this.cocoonBeanFactory.getBean(ProcessingUtil.SETTINGS_ROLE); - final String encoding = servletContext.getInitParameter("container-encoding"); + this.settings = (Settings) this.cocoonBeanFactory.getBean(Settings.ROLE); + final String encoding = settings.getContainerEncoding(); if ( encoding == null ) { containerEncoding = "ISO-8859-1"; } else { @@ -83,13 +83,14 @@ this.log = (Logger) this.cocoonBeanFactory.getBean(ProcessingUtil.LOGGER_ROLE); } - /* (non-Javadoc) + /** * @see javax.servlet.Filter#destroy() */ public void destroy() { + // nothing to do } - /* (non-Javadoc) + /** * @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain) */ public void doFilter(ServletRequest req, ServletResponse res, FilterChain filterChain) throws IOException, ServletException { Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/sitemap/SitemapServlet.java URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/sitemap/SitemapServlet.java?rev=418569&r1=418568&r2=418569&view=diff ============================================================================== --- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/sitemap/SitemapServlet.java (original) +++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/sitemap/SitemapServlet.java Sun Jul 2 04:03:28 2006 @@ -91,7 +91,7 @@ this.contextUrl = CoreUtil.getContextUrl(this.cocoonContext, MANIFEST_FILE); org.apache.avalon.framework.context.Context avalonContext; try { - avalonContext = CoreUtil.createContext(this.settings, this.cocoonContext, this.contextUrl, null, null); + avalonContext = CoreUtil.createContext(this.settings, this.cocoonContext, this.contextUrl, null); } catch (MalformedURLException e) { throw new ServletException(e); } Modified: cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/SitemapTestCase.java URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/SitemapTestCase.java?rev=418569&r1=418568&r2=418569&view=diff ============================================================================== --- cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/SitemapTestCase.java (original) +++ cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/SitemapTestCase.java Sun Jul 2 04:03:28 2006 @@ -27,7 +27,6 @@ import org.apache.avalon.framework.logger.Logger; import org.apache.avalon.framework.service.ServiceException; import org.apache.avalon.framework.service.ServiceManager; -import org.apache.cocoon.Cocoon; import org.apache.cocoon.Processor; import org.apache.cocoon.core.BootstrapEnvironment; import org.apache.cocoon.core.CoreUtil; @@ -54,8 +53,6 @@ private ConfigurableBeanFactory container; private ServiceManager serviceManager; - protected String processorClassName = Cocoon.class.getName(); - protected void setUp() throws Exception { super.setUp(); @@ -75,8 +72,7 @@ this.classDir = this.getClassDirURL().toExternalForm(); BootstrapEnvironment env = - new TestBootstrapEnvironment(this.getConfiguration(), - this.processorClassName); + new TestBootstrapEnvironment(this.getConfiguration()); this.coreUtil = new TestCoreUtil(env); this.processor = this.coreUtil.createProcessor(); Modified: cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/core/TestBootstrapEnvironment.java URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/core/TestBootstrapEnvironment.java?rev=418569&r1=418568&r2=418569&view=diff ============================================================================== --- cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/core/TestBootstrapEnvironment.java (original) +++ cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/core/TestBootstrapEnvironment.java Sun Jul 2 04:03:28 2006 @@ -23,12 +23,9 @@ implements BootstrapEnvironment { private final String configuration; - private String processorClassName; - public TestBootstrapEnvironment(String configuration, - String processorClassName) { + public TestBootstrapEnvironment(String configuration) { this.configuration = configuration; - this.processorClassName = processorClassName; } /** @@ -37,9 +34,9 @@ public void configure(MutableSettings settings) { settings.setConfiguration(this.configuration); settings.setWorkDirectory("work"); - settings.setProcessorClassName(this.processorClassName); } public void configure(DefaultContext context) { + // nothing to do here } } Modified: cocoon/trunk/core/cocoon-webapp/src/main/webapp/WEB-INF/web.xml URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-webapp/src/main/webapp/WEB-INF/web.xml?rev=418569&r1=418568&r2=418569&view=diff ============================================================================== --- cocoon/trunk/core/cocoon-webapp/src/main/webapp/WEB-INF/web.xml (original) +++ cocoon/trunk/core/cocoon-webapp/src/main/webapp/WEB-INF/web.xml Sun Jul 2 04:03:28 2006 @@ -39,17 +39,6 @@ <description>An override of the session cookie path</description> </context-param--> - <!-- Servlet Context Listener ======================================= --> - - <!--+ - | Declare a context listener that sets up the Cocoon Spring bean factory - | and makes it available as a context parameter. - +--> - - <listener> - <listener-class>org.apache.cocoon.servlet.CocoonServletListener</listener-class> - </listener> - <!-- Servlet Filters ================================================ --> <!--+ @@ -63,6 +52,48 @@ <filter-class>org.apache.cocoon.servlet.multipart.MultipartFilter</filter-class> </filter> + <!--+ + | Declare a filter for debugging incomming request + +--> + + <filter> + <filter-name></filter-name> + <display-name>Cocoon debug filter</display-name> + <description>Log debug information about each request</description> + <filter-class>org.apache.cocoon.servlet.DebugFilter</filter-class> + </filter> + + <!-- Filter mappings ================================================ --> + + <!--+ + | Use the Cocoon multipart filter together with the Cocoon demo webapp + +--> + + <filter-mapping> + <filter-name>CocoonMultipartFilter</filter-name> + <servlet-name>Cocoon</servlet-name> + </filter-mapping> + + <!--+ + | Use the Cocoon debug filter together with the Cocoon demo webapp + + <filter-mapping> + <filter-name>CocoonDebugFilter</filter-name> + <servlet-name>Cocoon</servlet-name> + </filter-mapping> + +--> + + <!-- Servlet Context Listener ======================================= --> + + <!--+ + | Declare a context listener that sets up the Cocoon Spring bean factory + | and makes it available as a context parameter. + +--> + + <listener> + <listener-class>org.apache.cocoon.servlet.CocoonServletListener</listener-class> + </listener> + <!-- Servlet Configuration ========================================== --> <servlet> @@ -73,35 +104,12 @@ <servlet-class>org.apache.cocoon.servlet.SitemapServlet</servlet-class> <!-- - Set encoding used by the container. If not set the ISO-8859-1 encoding - will be assumed. - Since the servlet specification requires that the ISO-8859-1 encoding - is used (by default), you should never change this value unless - you have a buggy servlet container. - --> - <init-param> - <param-name>container-encoding</param-name> - <param-value>ISO-8859-1</param-value> - </init-param> - - <!-- This parameter allows you to startup Cocoon2 immediately after startup of your servlet engine. --> <load-on-startup>1</load-on-startup> </servlet> - <!-- Filter mappings ================================================ --> - - <!--+ - | Use the Cocoon multipart filter together with the Cocoon demo webapp - +--> - - <filter-mapping> - <filter-name>CocoonMultipartFilter</filter-name> - <servlet-name>Cocoon</servlet-name> - </filter-mapping> - <!-- URL space mappings ============================================= --> <!-- From john82@example.net Sun Jul 02 16:12:54 2006 Return-Path: <john82@example.net> Delivered-To: john82@example.net Received: (qmail 63746 invoked from network); 2 Jul 2006 16:12:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 2 Jul 2006 16:12:54 -0000 Received: (qmail 81782 invoked by uid 500); 2 Jul 2006 16:12:53 -0000 Delivered-To: john82@example.net Received: (qmail 81728 invoked by uid 500); 2 Jul 2006 16:12:53 -0000 Mailing-List: contact john82@example.net; run by ezmlm Precedence: bulk Reply-To: john82@example.net list-help: <mailto:john82@example.net> list-unsubscribe: <mailto:john82@example.net> List-Post: <mailto:john82@example.net> List-Id: <cvs.cocoon.apache.org> Delivered-To: mailing list john82@example.net Received: (qmail 81713 invoked by uid 99); 2 Jul 2006 16:12:53 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 02 Jul 2006 09:12:53 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 02 Jul 2006 09:12:52 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 067D91A983A; Sun, 2 Jul 2006 09:12:32 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r418614 - in /cocoon/trunk: blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/environment/portlet/ blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portlet/ blocks/cocoon-portal/cocoon-portal-imp... Date: Sun, 02 Jul 2006 16:12:30 -0000 To: john82@example.net From: john82@example.net X-Mailer: svnmailer-1.0.8 Message-Id: <john82@example.net> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: cziegeler Date: Sun Jul 2 09:12:28 2006 New Revision: 418614 URL: http://svn.apache.org/viewvc?rev=418614&view=rev Log: Delete obsolete classes and move cli and portlet env to own directories (these are not included in the build as they are not working anyway) Added: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-env/ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-env/src/ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-env/src/main/ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-env/src/main/java/ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-env/src/main/java/org/ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-env/src/main/java/org/apache/ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-env/src/main/java/org/apache/cocoon/ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-env/src/main/java/org/apache/cocoon/environment/ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-env/src/main/java/org/apache/cocoon/environment/portlet/ - copied from r418563, cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/environment/portlet/ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-env/src/main/java/org/apache/cocoon/portlet/ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-env/src/main/java/org/apache/cocoon/portlet/CocoonPortlet.java - copied unchanged from r418563, cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portlet/CocoonPortlet.java cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-env/src/main/java/org/apache/cocoon/portlet/ManagedCocoonPortlet.java - copied unchanged from r418563, cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portlet/ManagedCocoonPortlet.java cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-env/src/main/java/org/apache/cocoon/portlet/PortletLogger.java - copied unchanged from r418563, cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portlet/PortletLogger.java cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-env/src/main/java/org/apache/cocoon/portlet/SettingsHelper.java - copied unchanged from r418563, cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portlet/SettingsHelper.java cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-env/src/main/java/org/apache/cocoon/portlet/multipart/ - copied from r418563, cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portlet/multipart/ cocoon/trunk/core/cocoon-cli/ cocoon/trunk/core/cocoon-cli/src/ cocoon/trunk/core/cocoon-cli/src/main/ cocoon/trunk/core/cocoon-cli/src/main/java/ cocoon/trunk/core/cocoon-cli/src/main/java/org/ cocoon/trunk/core/cocoon-cli/src/main/java/org/apache/ cocoon/trunk/core/cocoon-cli/src/main/java/org/apache/cocoon/ cocoon/trunk/core/cocoon-cli/src/main/java/org/apache/cocoon/bean/ cocoon/trunk/core/cocoon-cli/src/main/java/org/apache/cocoon/bean/BeanListener.java - copied unchanged from r418563, cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/bean/BeanListener.java cocoon/trunk/core/cocoon-cli/src/main/java/org/apache/cocoon/bean/CocoonBean.java - copied unchanged from r418563, cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/bean/CocoonBean.java cocoon/trunk/core/cocoon-cli/src/main/java/org/apache/cocoon/bean/CocoonWrapper.java - copied unchanged from r418563, cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/bean/CocoonWrapper.java cocoon/trunk/core/cocoon-cli/src/main/java/org/apache/cocoon/bean/Target.java - copied unchanged from r418563, cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/bean/Target.java cocoon/trunk/core/cocoon-cli/src/main/java/org/apache/cocoon/bean/helpers/ - copied from r418563, cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/bean/helpers/ Removed: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/environment/portlet/ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portlet/CocoonPortlet.java cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portlet/ManagedCocoonPortlet.java cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portlet/PortletLogger.java cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portlet/SettingsHelper.java cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portlet/multipart/ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/Cocoon.java cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/CocoonAccess.java cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/bean/BeanListener.java cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/bean/CocoonBean.java cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/bean/CocoonWrapper.java cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/bean/Target.java cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/bean/helpers/ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/CocoonServlet.java Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/CoreUtil.java cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/BeanFactoryFactoryImpl.java cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/BeanFactoryUtil.java cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/XmlConfigCreator.java cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/osgi/OSGiSpringECMFactory.java cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/core/container/ContainerTestCase.java Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/CoreUtil.java URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/CoreUtil.java?rev=418614&r1=418613&r2=418614&view=diff ============================================================================== --- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/CoreUtil.java (original) +++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/CoreUtil.java Sun Jul 2 09:12:28 2006 @@ -612,7 +612,7 @@ env.settings = this.settings; ConfigurableBeanFactory rootContext = BeanFactoryUtil.createRootBeanFactory(env, this.environmentContext); ConfigurationInfo result = ConfigReader.readConfiguration(settings.getConfiguration(), env); - ConfigurableBeanFactory mainContext = BeanFactoryUtil.createBeanFactory(env, result, null, rootContext, true); + ConfigurableBeanFactory mainContext = BeanFactoryUtil.createBeanFactory(env, result, null, rootContext); this.settings.setCreationTime(System.currentTimeMillis()); return mainContext; Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/BeanFactoryFactoryImpl.java URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/BeanFactoryFactoryImpl.java?rev=418614&r1=418613&r2=418614&view=diff ============================================================================== --- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/BeanFactoryFactoryImpl.java (original) +++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/BeanFactoryFactoryImpl.java Sun Jul 2 09:12:28 2006 @@ -100,7 +100,7 @@ final ConfigurationInfo parentConfigInfo = (ConfigurationInfo) parentFactory .getBean(ConfigurationInfo.class.getName()); final ConfigurationInfo ci = ConfigReader.readConfiguration(config, parentConfigInfo, ae, resolver); - return BeanFactoryUtil.createBeanFactory(classLoader, ae, ci, resolver, parentFactory, false); + return BeanFactoryUtil.createBeanFactory(classLoader, ae, ci, resolver, parentFactory); } return parentFactory; } Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/BeanFactoryUtil.java URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/BeanFactoryUtil.java?rev=418614&r1=418613&r2=418614&view=diff ============================================================================== --- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/BeanFactoryUtil.java (original) +++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/BeanFactoryUtil.java Sun Jul 2 09:12:28 2006 @@ -73,10 +73,9 @@ public static ConfigurableListableBeanFactory createBeanFactory(AvalonEnvironment env, ConfigurationInfo info, SourceResolver resolver, - BeanFactory parent, - boolean addCocoon) + BeanFactory parent) throws Exception { - return createBeanFactory(env, info, resolver, parent, addCocoon, true); + return createBeanFactory(env, info, resolver, parent, true); } /** @@ -92,10 +91,9 @@ AvalonEnvironment env, ConfigurationInfo info, SourceResolver resolver, - BeanFactory parent, - boolean addCocoon) + BeanFactory parent) throws Exception { - return createBeanFactory(classLoader, env, info, resolver, parent, addCocoon, true); + return createBeanFactory(classLoader, env, info, resolver, parent, true); } /** @@ -111,10 +109,9 @@ ConfigurationInfo info, SourceResolver resolver, BeanFactory parent, - boolean addCocoon, boolean preInstantiateSingletons) throws Exception { - return createBeanFactory(Thread.currentThread().getContextClassLoader(), env, info, resolver, parent, addCocoon, preInstantiateSingletons); + return createBeanFactory(Thread.currentThread().getContextClassLoader(), env, info, resolver, parent, preInstantiateSingletons); } /** @@ -131,7 +128,6 @@ ConfigurationInfo info, SourceResolver resolver, BeanFactory parent, - boolean addCocoon, boolean preInstantiateSingletons) throws Exception { final ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader(); @@ -139,7 +135,7 @@ if ( classLoader != null ) { Thread.currentThread().setContextClassLoader(classLoader); } - final String xmlConfig = (new XmlConfigCreator(env.logger)).createConfig(info, addCocoon); + final String xmlConfig = (new XmlConfigCreator(env.logger)).createConfig(info); Resource rsc = new ByteArrayResource(xmlConfig.getBytes("utf-8")); Logger logger = env.logger; if ( info.rootLogger != null ) { Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/XmlConfigCreator.java URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/XmlConfigCreator.java?rev=418614&r1=418613&r2=418614&view=diff ============================================================================== --- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/XmlConfigCreator.java (original) +++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/XmlConfigCreator.java Sun Jul 2 09:12:28 2006 @@ -21,13 +21,9 @@ import java.util.Map; import org.apache.avalon.excalibur.pool.Poolable; -import org.apache.avalon.framework.context.Context; import org.apache.avalon.framework.logger.Logger; -import org.apache.avalon.framework.service.ServiceManager; import org.apache.avalon.framework.thread.ThreadSafe; -import org.apache.cocoon.Cocoon; import org.apache.cocoon.ProcessingUtil; -import org.apache.cocoon.Processor; import org.springframework.util.StringUtils; /** @@ -53,7 +49,7 @@ this.logger = log; } - public String createConfig(ConfigurationInfo info, boolean addCocoon) + public String createConfig(ConfigurationInfo info) throws Exception { final Map components = info.getComponents(); final List pooledRoles = new ArrayList(); @@ -177,27 +173,6 @@ this.appendAttribute(buffer, "alias", current.getAlias()); buffer.append("/>\n"); } - } - // add the Cocoon object to the root - if ( addCocoon ) { - buffer.append("<bean"); - this.appendAttribute(buffer, "id", Cocoon.class.getName()); - this.appendAttribute(buffer, "class", Cocoon.class.getName()); - this.appendAttribute(buffer, "singleton", "true"); - buffer.append(">\n"); - buffer.append(" <constructor-arg ref=\""); - buffer.append(Processor.ROLE); - buffer.append("\"/>\n"); - buffer.append(" <constructor-arg ref=\""); - buffer.append(ServiceManager.class.getName()); - buffer.append("\"/>\n"); - buffer.append(" <constructor-arg ref=\""); - buffer.append(Context.class.getName()); - buffer.append("\"/>\n"); - buffer.append(" <constructor-arg ref=\""); - buffer.append(Logger.class.getName()); - buffer.append("\"/>\n"); - buffer.append("</bean>\n"); } buffer.append("</beans>\n"); Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/osgi/OSGiSpringECMFactory.java URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/osgi/OSGiSpringECMFactory.java?rev=418614&r1=418613&r2=418614&view=diff ============================================================================== --- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/osgi/OSGiSpringECMFactory.java (original) +++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/osgi/OSGiSpringECMFactory.java Sun Jul 2 09:12:28 2006 @@ -126,7 +126,7 @@ this.parentBeanfactory = BeanFactoryUtil.createRootBeanFactory(avalonEnvironment, osgiServletContext); ConfigurationInfo springBeanConfiguration = ConfigReader.readConfiguration(configFile, avalonEnvironment); this.beanFactory = BeanFactoryUtil.createBeanFactory(avalonEnvironment, springBeanConfiguration, - null, this.parentBeanfactory, false, false); + null, this.parentBeanfactory, false); this.beanFactory.addBeanPostProcessor(new ServiceRegistrationPostProcessor()); this.beanFactory.preInstantiateSingletons(); // What is this for? Modified: cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/core/container/ContainerTestCase.java URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/core/container/ContainerTestCase.java?rev=418614&r1=418613&r2=418614&view=diff ============================================================================== --- cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/core/container/ContainerTestCase.java (original) +++ cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/core/container/ContainerTestCase.java Sun Jul 2 09:12:28 2006 @@ -301,7 +301,7 @@ // read roles and components ConfigurationInfo rolesInfo = ConfigReader.readConfiguration(confRM, confCM, null, avalonEnv, null); this.addComponents( rolesInfo ); - this.beanFactory = BeanFactoryUtil.createBeanFactory(avalonEnv, rolesInfo, null, this.rootBeanFactory, false); + this.beanFactory = BeanFactoryUtil.createBeanFactory(avalonEnv, rolesInfo, null, this.rootBeanFactory); this.manager = (ServiceManager)this.beanFactory.getBean(ServiceManager.class.getName()); } From john82@example.net Sun Jul 02 17:32:24 2006 Return-Path: <john82@example.net> Delivered-To: john82@example.net Received: (qmail 82391 invoked from network); 2 Jul 2006 17:32:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 2 Jul 2006 17:32:24 -0000 Received: (qmail 19834 invoked by uid 500); 2 Jul 2006 17:32:23 -0000 Delivered-To: john82@example.net Received: (qmail 19695 invoked by uid 500); 2 Jul 2006 17:32:23 -0000 Mailing-List: contact john82@example.net; run by ezmlm Precedence: bulk Reply-To: john82@example.net list-help: <mailto:john82@example.net> list-unsubscribe: <mailto:john82@example.net> List-Post: <mailto:john82@example.net> List-Id: <cvs.cocoon.apache.org> Delivered-To: mailing list john82@example.net Received: (qmail 19683 invoked by uid 99); 2 Jul 2006 17:32:23 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 02 Jul 2006 10:32:23 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 02 Jul 2006 10:32:21 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 799301A983A; Sun, 2 Jul 2006 10:32:01 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r418624 - in /cocoon/trunk: blocks/cocoon-cron/cocoon-cron-impl/src/main/java/org/apache/cocoon/environment/background/ blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/components/modules/input/ blocks/cocoon-portal/c... Date: Sun, 02 Jul 2006 17:32:00 -0000 To: john82@example.net From: john82@example.net X-Mailer: svnmailer-1.0.8 Message-Id: <john82@example.net> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: cziegeler Date: Sun Jul 2 10:31:59 2006 New Revision: 418624 URL: http://svn.apache.org/viewvc?rev=418624&view=rev Log: Delete obsolete classes and move cli and portlet env to own directories (these are not included in the build as they are not working anyway) Added: cocoon/trunk/blocks/cocoon-cron/cocoon-cron-impl/src/main/java/org/apache/cocoon/environment/background/BackgroundRequest.java (with props) cocoon/trunk/blocks/cocoon-cron/cocoon-cron-impl/src/main/java/org/apache/cocoon/environment/background/BackgroundResponse.java (with props) cocoon/trunk/blocks/cocoon-cron/cocoon-cron-impl/src/main/java/org/apache/cocoon/environment/background/BackgroundSession.java (with props) cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-env/src/main/java/org/apache/cocoon/components/ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-env/src/main/java/org/apache/cocoon/components/modules/ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-portlet-env/src/main/java/org/apache/cocoon/components/modules/input/ - copied from r418563, cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/components/modules/input/ cocoon/trunk/core/cocoon-cli/src/main/java/org/apache/cocoon/Main.java - copied unchanged from r418563, cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/Main.java cocoon/trunk/core/cocoon-cli/src/main/java/org/apache/cocoon/environment/ cocoon/trunk/core/cocoon-cli/src/main/java/org/apache/cocoon/environment/commandline/ - copied from r418563, cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/environment/commandline/ cocoon/trunk/core/cocoon-cli/src/main/test/ cocoon/trunk/core/cocoon-cli/src/main/test/org/ cocoon/trunk/core/cocoon-cli/src/main/test/org/apache/ cocoon/trunk/core/cocoon-cli/src/main/test/org/apache/cocoon/ cocoon/trunk/core/cocoon-cli/src/main/test/org/apache/cocoon/bean/ - copied from r418563, cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/bean/ cocoon/trunk/core/cocoon-cli/src/main/test/org/apache/cocoon/environment/ cocoon/trunk/core/cocoon-cli/src/main/test/org/apache/cocoon/environment/commandline/ cocoon/trunk/core/cocoon-cli/src/main/test/org/apache/cocoon/environment/commandline/test/ - copied from r418563, cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/environment/commandline/test/ Removed: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/components/modules/input/ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/Main.java cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/environment/commandline/ cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/bean/ cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/environment/commandline/test/ Modified: cocoon/trunk/blocks/cocoon-cron/cocoon-cron-impl/src/main/java/org/apache/cocoon/environment/background/BackgroundEnvironment.java Modified: cocoon/trunk/blocks/cocoon-cron/cocoon-cron-impl/src/main/java/org/apache/cocoon/environment/background/BackgroundEnvironment.java URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-cron/cocoon-cron-impl/src/main/java/org/apache/cocoon/environment/background/BackgroundEnvironment.java?rev=418624&r1=418623&r2=418624&view=diff ============================================================================== --- cocoon/trunk/blocks/cocoon-cron/cocoon-cron-impl/src/main/java/org/apache/cocoon/environment/background/BackgroundEnvironment.java (original) +++ cocoon/trunk/blocks/cocoon-cron/cocoon-cron-impl/src/main/java/org/apache/cocoon/environment/background/BackgroundEnvironment.java Sun Jul 2 10:31:59 2006 @@ -24,8 +24,6 @@ import org.apache.cocoon.environment.Context; import org.apache.cocoon.environment.ObjectModelHelper; import org.apache.cocoon.environment.Request; -import org.apache.cocoon.environment.commandline.CommandLineRequest; -import org.apache.cocoon.environment.commandline.CommandLineResponse; import org.apache.cocoon.util.NullOutputStream; /** @@ -44,7 +42,7 @@ this.outputStream = new NullOutputStream(); // TODO Would special Background*-objects have advantages? - Request request = new CommandLineRequest( + Request request = new BackgroundRequest( this, // environment "", // context path "", // servlet path @@ -55,7 +53,7 @@ ); this.objectModel.put(ObjectModelHelper.REQUEST_OBJECT, request); this.objectModel.put(ObjectModelHelper.RESPONSE_OBJECT, - new CommandLineResponse()); + new BackgroundResponse()); this.objectModel.put(ObjectModelHelper.CONTEXT_OBJECT, ctx); } Added: cocoon/trunk/blocks/cocoon-cron/cocoon-cron-impl/src/main/java/org/apache/cocoon/environment/background/BackgroundRequest.java URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-cron/cocoon-cron-impl/src/main/java/org/apache/cocoon/environment/background/BackgroundRequest.java?rev=418624&view=auto ============================================================================== --- cocoon/trunk/blocks/cocoon-cron/cocoon-cron-impl/src/main/java/org/apache/cocoon/environment/background/BackgroundRequest.java (added) +++ cocoon/trunk/blocks/cocoon-cron/cocoon-cron-impl/src/main/java/org/apache/cocoon/environment/background/BackgroundRequest.java Sun Jul 2 10:31:59 2006 @@ -0,0 +1,438 @@ +/* + * Copyright 1999-2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.cocoon.environment.background; + +import java.io.InputStream; +import java.util.Collections; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; +import java.util.Vector; + +import org.apache.cocoon.Constants; +import org.apache.cocoon.environment.Cookie; +import org.apache.cocoon.environment.Environment; +import org.apache.cocoon.environment.Request; +import org.apache.cocoon.environment.Session; +import org.apache.cocoon.environment.impl.AbstractRequest; +import org.apache.commons.collections.IteratorUtils; +import org.apache.commons.lang.SystemUtils; +import org.apache.commons.lang.NotImplementedException; + +/** + * Creates a specific servlet request simulation from command line usage. + * + * @version $Id$ + */ +/* + * NOTE: method with a non-compliant implementation are marked with FIXME + * and should be fixed in the future if required + */ +public class BackgroundRequest extends AbstractRequest { + + private class EmptyEnumeration implements Enumeration { + public boolean hasMoreElements() { + return false; + } + public Object nextElement() { + return null; + } + } + + private Environment env; + private String contextPath; + private String servletPath; + private String pathInfo; + private Map globalAttributes; + private Map attributes; + private Map parameters; + private Map headers; + private String characterEncoding; + + public BackgroundRequest(Environment env, + String contextPath, + String servletPath, + String pathInfo) { + this(env, contextPath, servletPath, pathInfo, null, null, null); + } + + public BackgroundRequest(Environment env, + String contextPath, + String servletPath, + String pathInfo, + Map attributes) { + this(env, contextPath, servletPath, pathInfo, attributes, null, null); + } + + public BackgroundRequest(Environment env, + String contextPath, + String servletPath, + String pathInfo, + Map attributes, + Map parameters) { + this(env, contextPath, servletPath, pathInfo, attributes, parameters, null); + } + + public BackgroundRequest(Environment env, + String contextPath, + String servletPath, + String pathInfo, + Map attributes, + Map parameters, + Map headers) { + this.env = env; + this.contextPath = contextPath; + this.servletPath = servletPath; + this.pathInfo = pathInfo; + this.globalAttributes = (attributes == null ? new HashMap() : attributes); + this.attributes = new HashMap(); + this.parameters = parameters; + this.headers = headers; + } + + /* (non-Javadoc) + * @see org.apache.cocoon.environment.Request#get(java.lang.String) + */ + public Object get(String name) { + String[] values = this.getParameterValues(name); + if (values == null || values.length == 0) { + return null; + } else if (values.length == 1) { + return values[0]; + } else { + Vector vect = new Vector(values.length); + for (int i = 0; i < values.length; i++) { + vect.add(values[i]); + } + return vect; + } + } + + public String getContextPath() { return contextPath; } + public String getServletPath() { return servletPath; } + public String getPathInfo() { return pathInfo; } + public String getRequestURI() { + StringBuffer buffer = new StringBuffer(); + if (servletPath != null) buffer.append(servletPath); + if (contextPath != null) buffer.append(contextPath); + if (pathInfo != null) buffer.append(pathInfo); + return buffer.toString(); + } + // FIXME + public String getSitemapURI() { + return this.env.getURI(); + } + public String getSitemapURIPrefix() { + return this.env.getURIPrefix(); + } + /* (non-Javadoc) + * @see org.apache.cocoon.environment.Request#getSitemapPath() + */ + public String getSitemapPath() { + return this.env.getURIPrefix(); + } + + public String getQueryString() { return null; } // use parameters instead + public String getPathTranslated() { return null; } // FIXME (SM) this is legal but should we do something more? + + /* (non-Javadoc) + * @see org.apache.cocoon.environment.Request#getAttribute(java.lang.String) + */ + public Object getAttribute(String name) { + return this.getAttribute(name,
{'source': 'Apache Software Foundation Public Mail Archives'}