Author: sylvain Date: Tue Jan 18 00:39:32 2005 New Revision: 125470 URL: http://svn.apache.org/viewcvs?view=rev&rev=125470 Log: Load the configuration file lazily to allow for 'cocoon:' urls Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/acting/BookmarkAction.java
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/acting/BookmarkAction.java Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/acting/BookmarkAction.java?view=diff&rev=125470&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/acting/BookmarkAction.java&r1=125469&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/acting/BookmarkAction.java&r2=125470 ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/acting/BookmarkAction.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/acting/BookmarkAction.java Tue Jan 18 00:39:32 2005 @@ -77,14 +77,27 @@ protected String historyParameterName; + protected String configurationFile; + /* (non-Javadoc) * @see org.apache.avalon.framework.parameters.Parameterizable#parameterize(org.apache.avalon.framework.parameters.Parameters) */ public void parameterize(Parameters parameters) throws ParameterException { this.historyParameterName = parameters.getParameter("history-parameter-name", "history"); - final String configurationFile = parameters.getParameter("src", null); - if ( configurationFile == null ) return; + this.configurationFile = parameters.getParameter("src", null); + if ( this.configurationFile == null ) return; + + // The "lazy-load" parameter allows to defer loading of the config from "src" at + // the first call to act. This is for now undocumented until + // That was needed in the case of a dynamic source ("cocoon://blah") produced by the sitemap where + // the action is defined. Loading immediately in that case leads to an infinite loop where the sitemap + // is constantly reloaded. + if (!parameters.getParameterAsBoolean("lazy-load", false)) { + loadConfig(); + } + } + private void loadConfig() throws ParameterException { Configuration config; org.apache.excalibur.source.SourceResolver resolver = null; try { @@ -153,6 +166,9 @@ } } } + + // Nullify config filename so as not to reload it. + this.configurationFile = null; } public Map act(Redirector redirector, @@ -166,6 +182,10 @@ ", objectModel="+objectModel+ ", source="+source+ ", par="+par); + } + + if (this.configurationFile != null) { + loadConfig(); } Map result;