Author: thorsten Date: Thu Aug 27 11:20:57 2009 New Revision: 808371 URL: http://svn.apache.org/viewvc?rev=808371&view=rev Log: Fixing contract to not fail if no contract can be found. Enhancing the solution by passing the name of the contract that is not found to the output.
Modified: forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/cocoon-2.2-block/src/main/resources/COB-INF/resource/themer/themes/common/html/noFt.contract.xml forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java Modified: forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/cocoon-2.2-block/src/main/resources/COB-INF/resource/themer/themes/common/html/noFt.contract.xml URL: http://svn.apache.org/viewvc/forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/cocoon-2.2-block/src/main/resources/COB-INF/resource/themer/themes/common/html/noFt.contract.xml?rev=808371&r1=808370&r2=808371&view=diff ============================================================================== --- forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/cocoon-2.2-block/src/main/resources/COB-INF/resource/themer/themes/common/html/noFt.contract.xml (original) +++ forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/cocoon-2.2-block/src/main/resources/COB-INF/resource/themer/themes/common/html/noFt.contract.xml Thu Aug 27 11:20:57 2009 @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="UTF-8"?> +<?xml version="1.0" encoding="utf-8"?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -15,28 +15,25 @@ See the License for the specific language governing permissions and limitations under the License. --> -<forrest:contract xmlns:forrest="http://apache.org/forrest/templates/1.0" - name="noFt"> +<forrest:contract xmlns:forrest="http://apache.org/forrest/templates/1.0" +name="noFt"> <description> - <p> - Error 440 - <br/> - Template not found. This functions is a fallback when no ft is found. This - is just a dummy, it will output *nothing*. - </p> + <p>Error 440 + <br />Template not found. This functions is a fallback when no ft is found. + This is just a dummy, it will output *nothing*.</p> </description> <usage> -<![CDATA[<forrest:contract name="doNotUseJustDummy"/>]]> - </usage> - <forrest:template xmlns:forrest="http://apache.org/forrest/templates/1.0" - format="html" name="noFt" inputFormat="xsl" > - <xsl:stylesheet version="1.1" - xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> - <xsl:template name="/"> + <![CDATA[<forrest:contract name="doNotUseJustDummy"/>]]> +</usage> + <forrest:template xmlns:forrest="http://apache.org/forrest/templates/1.0" + format="html" name="noFt" inputFormat="xsl"> + <xsl:stylesheet version="1.1" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + <xsl:param name="contract.name" select="'noName'"/> + <xsl:template match="/"> <forrest:content> - <forrest:part> - Error 440 - Template not found. - </forrest:part> + <forrest:part>Error 440 - Contract + "<xsl:value-of select="$contract.name"/>" not found.</forrest:part> </forrest:content> </xsl:template> </xsl:stylesheet> Modified: forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java URL: http://svn.apache.org/viewvc/forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java?rev=808371&r1=808370&r2=808371&view=diff ============================================================================== --- forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java (original) +++ forrest/branches/dispatcher_rewrite/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java Thu Aug 27 11:20:57 2009 @@ -766,6 +766,7 @@ contract = contractRep.resolve(name); // prepare empty properties map localParams = new HashMap<String, Object>(map); + localParams.put("contract.name", name); } catch (Exception e) { String error = DispatcherException.ERROR_500 + "\n" + "component: ContractBean" + "\n"