You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by vg...@apache.org on 2005/03/11 17:23:55 UTC

svn commit: r157100 - in cocoon/trunk/src: samples/org/apache/cocoon/samples/errorhandling/ webapp/samples/ webapp/samples/errorhandling/ webapp/samples/errorhandling/exception/

Author: vgritsenko
Date: Fri Mar 11 08:23:50 2005
New Revision: 157100

URL: http://svn.apache.org/viewcvs?view=rev&rev=157100
Log:
error handling samples refactoring

Added:
    cocoon/trunk/src/samples/org/apache/cocoon/samples/errorhandling/ExceptionAction.java   (props changed)
      - copied unchanged from r157096, cocoon/branches/BRANCH_2_1_X/src/samples/org/apache/cocoon/samples/errorhandling/ExceptionAction.java
    cocoon/trunk/src/webapp/samples/errorhandling/notFound.html   (props changed)
      - copied unchanged from r157096, cocoon/branches/BRANCH_2_1_X/src/webapp/samples/errorhandling/notFound.html
Removed:
    cocoon/trunk/src/webapp/samples/errorhandling/generalerror.htm
    cocoon/trunk/src/webapp/samples/errorhandling/resourceNotFound.htm
Modified:
    cocoon/trunk/src/samples/org/apache/cocoon/samples/errorhandling/ApplicationException.java
    cocoon/trunk/src/samples/org/apache/cocoon/samples/errorhandling/ExceptionGenerator.java
    cocoon/trunk/src/samples/org/apache/cocoon/samples/errorhandling/ValidationException.java
    cocoon/trunk/src/webapp/samples/errorhandling/exception/application.htm
    cocoon/trunk/src/webapp/samples/errorhandling/exception/application1.htm
    cocoon/trunk/src/webapp/samples/errorhandling/exception/application2.htm
    cocoon/trunk/src/webapp/samples/errorhandling/exception/error-giving-page.xml
    cocoon/trunk/src/webapp/samples/errorhandling/exception/sitemap.xmap
    cocoon/trunk/src/webapp/samples/errorhandling/exception/validation.htm
    cocoon/trunk/src/webapp/samples/errorhandling/samples.xml
    cocoon/trunk/src/webapp/samples/errorhandling/sitemap.xmap
    cocoon/trunk/src/webapp/samples/samples.xml

Modified: cocoon/trunk/src/samples/org/apache/cocoon/samples/errorhandling/ApplicationException.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/samples/org/apache/cocoon/samples/errorhandling/ApplicationException.java?view=diff&r1=157099&r2=157100
==============================================================================
--- cocoon/trunk/src/samples/org/apache/cocoon/samples/errorhandling/ApplicationException.java (original)
+++ cocoon/trunk/src/samples/org/apache/cocoon/samples/errorhandling/ApplicationException.java Fri Mar 11 08:23:50 2005
@@ -1,12 +1,12 @@
 /*
- * Copyright 1999-2004 The Apache Software Foundation.
- * 
+ * 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.
@@ -16,23 +16,26 @@
 package org.apache.cocoon.samples.errorhandling;
 
 /**
-* @author <a href="mailto:bluetkemeier@s-und-n.de">Bj&ouml;rn L&uuml;tkemeier</a>
-* 
-* @version CVS $Id: ApplicationException.java,v 1.3 2004/03/05 13:03:02 bdelacretaz Exp $
-*/
-public class ApplicationException 
-extends Exception {
-	private int errorCode;
-	
-	public ApplicationException(int errorCode) {
-		this.errorCode = errorCode;
-	}
-	
-	public void setErrorCode(int errorCode) {
-		this.errorCode = errorCode;
-	}
-	
-	public int getErrorCode() {
-		return this.errorCode;
-	}
+ * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj&ouml;rn L&uuml;tkemeier</a>
+ * @version $Id$
+ */
+public class ApplicationException extends Exception {
+    private int errorCode;
+
+    public ApplicationException(int errorCode, String message) {
+        super(message);
+        this.errorCode = errorCode;
+    }
+
+    public ApplicationException(int errorCode) {
+        this.errorCode = errorCode;
+    }
+
+    public void setErrorCode(int errorCode) {
+        this.errorCode = errorCode;
+    }
+
+    public int getErrorCode() {
+        return this.errorCode;
+    }
 }

Copied: cocoon/trunk/src/samples/org/apache/cocoon/samples/errorhandling/ExceptionAction.java (from r157096, cocoon/branches/BRANCH_2_1_X/src/samples/org/apache/cocoon/samples/errorhandling/ExceptionAction.java)
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/samples/org/apache/cocoon/samples/errorhandling/ExceptionAction.java?view=diff&rev=157100&p1=cocoon/branches/BRANCH_2_1_X/src/samples/org/apache/cocoon/samples/errorhandling/ExceptionAction.java&r1=157096&p2=cocoon/trunk/src/samples/org/apache/cocoon/samples/errorhandling/ExceptionAction.java&r2=157100
==============================================================================
    (empty)

Propchange: cocoon/trunk/src/samples/org/apache/cocoon/samples/errorhandling/ExceptionAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/src/samples/org/apache/cocoon/samples/errorhandling/ExceptionAction.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: cocoon/trunk/src/samples/org/apache/cocoon/samples/errorhandling/ExceptionGenerator.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/samples/org/apache/cocoon/samples/errorhandling/ExceptionGenerator.java?view=diff&r1=157099&r2=157100
==============================================================================
--- cocoon/trunk/src/samples/org/apache/cocoon/samples/errorhandling/ExceptionGenerator.java (original)
+++ cocoon/trunk/src/samples/org/apache/cocoon/samples/errorhandling/ExceptionGenerator.java Fri Mar 11 08:23:50 2005
@@ -1,72 +1,66 @@
 /*
- * Copyright 1999-2004 The Apache Software Foundation.
- * 
+ * 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.samples.errorhandling;
 
-import java.io.IOException;
+import org.apache.avalon.framework.parameters.Parameters;
 
 import org.apache.cocoon.ProcessingException;
-import org.apache.cocoon.ResourceNotFoundException;
-import org.apache.cocoon.environment.ObjectModelHelper;
-import org.apache.cocoon.environment.Request;
+import org.apache.cocoon.environment.SourceResolver;
 import org.apache.cocoon.generation.AbstractGenerator;
+
 import org.xml.sax.Attributes;
 import org.xml.sax.SAXException;
 import org.xml.sax.helpers.AttributesImpl;
 
+import java.io.IOException;
+import java.util.Map;
+
 /**
- * Exception generator.
+ * Exception generator. Throws different kinds of exception depending on
+ * value of src attribute.
  *
  * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj&ouml;rn L&uuml;tkemeier</a>
- * @version CVS $Id: ExceptionGenerator.java,v 1.5 2004/03/05 13:03:02 bdelacretaz Exp $
+ * @author <a href="mailto:vgritsenko@apache.org">Vadim Gritsenko</a>
+ * @version $Id$
  */
 public class ExceptionGenerator extends AbstractGenerator {
 
-    /** Name of request parameters. */
-    public static final String PAR_EXCEPTION = "exception";
+    private String exception;
+    private int code;
 
-    public static final String PAR_CODE = "code";
+    public void setup(SourceResolver resolver, Map objectModel, String src, Parameters parameters)
+    throws ProcessingException, SAXException, IOException {
+        super.setup(resolver, objectModel, src, parameters);
+
+        this.exception = parameters.getParameter("exception", super.source);
+        this.code = Integer.parseInt(parameters.getParameter("code", "0"));
+
+        // Throw exception in the setup phase?
+        if (parameters.getParameterAsBoolean("setup", false)) {
+            ExceptionAction.exception(this.exception, this.code);
+        }
+    }
 
     /**
      * Overridden from superclass.
      */
     public void generate()
-      throws IOException, SAXException, ProcessingException {
-        Request request = ObjectModelHelper.getRequest(this.objectModel);
-        String exception = request.getParameter(PAR_EXCEPTION);
-        String text = null;
-
-        if (exception==null) {
-            text = "No exception occured.";
-        } else if (exception.equals("validation")) {
-            throw new ProcessingException(new ValidationException());
-        } else if (exception.equals("application")) {
-            throw new ProcessingException(new ApplicationException(Integer.parseInt(request.getParameter(PAR_CODE))));
-        } else if (exception.equals("resourceNotFound")) {
-            throw new ProcessingException(new ResourceNotFoundException(""));
-        } else if (exception.equals("nullPointer")) {
-            throw new NullPointerException();
-        } else if (exception.equals("error")) {
-            throw new Error("Error");
-        } else {
-            text = "Unknown exception requested.";
-        }
-
+    throws ProcessingException , SAXException, IOException {
+        String text = ExceptionAction.exception(this.exception, this.code);
         Attributes noAttrs = new AttributesImpl();
-
         this.contentHandler.startDocument();
         this.contentHandler.startElement("", "html", "html", noAttrs);
         this.contentHandler.startElement("", "body", "body", noAttrs);

Modified: cocoon/trunk/src/samples/org/apache/cocoon/samples/errorhandling/ValidationException.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/samples/org/apache/cocoon/samples/errorhandling/ValidationException.java?view=diff&r1=157099&r2=157100
==============================================================================
--- cocoon/trunk/src/samples/org/apache/cocoon/samples/errorhandling/ValidationException.java (original)
+++ cocoon/trunk/src/samples/org/apache/cocoon/samples/errorhandling/ValidationException.java Fri Mar 11 08:23:50 2005
@@ -1,27 +1,31 @@
 /*
-* Copyright 1999-2004 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.
-*/
-/*
-	ValidationException.java
-
-	Author: Bj&ouml;rn L&uuml;tkemeier <bl...@s-und-n.de>
-	Date: April 23, 2003
-
+ * 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.samples.errorhandling;
 
-public class ValidationException 
-extends Exception {
+/**
+ * @author Bj&ouml;rn L&uuml;tkemeier <bl...@s-und-n.de>
+ * @since April 23, 2003
+ * @version $Id$
+ */
+public class ValidationException extends Exception {
+    public ValidationException() {
+        super();
+    }
+
+    public ValidationException(String message) {
+        super(message);
+    }
 }

Modified: cocoon/trunk/src/webapp/samples/errorhandling/exception/application.htm
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/webapp/samples/errorhandling/exception/application.htm?view=diff&r1=157099&r2=157100
==============================================================================
--- cocoon/trunk/src/webapp/samples/errorhandling/exception/application.htm (original)
+++ cocoon/trunk/src/webapp/samples/errorhandling/exception/application.htm Fri Mar 11 08:23:50 2005
@@ -13,8 +13,13 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
+
 <html>
-	<body>
-		<p>An ApplicationException has occured. Handled by pipelines' error handler.</p>
-	</body>
-</html>
\ No newline at end of file
+  <body>
+    <p>
+      An <b>ApplicationException</b> has occured.
+      Handled by <code>map:pipelines</code> error handler in
+      <code>errorhandling/exception/sitemap.xmap</code>.
+    </p>
+  </body>
+</html>

Modified: cocoon/trunk/src/webapp/samples/errorhandling/exception/application1.htm
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/webapp/samples/errorhandling/exception/application1.htm?view=diff&r1=157099&r2=157100
==============================================================================
--- cocoon/trunk/src/webapp/samples/errorhandling/exception/application1.htm (original)
+++ cocoon/trunk/src/webapp/samples/errorhandling/exception/application1.htm Fri Mar 11 08:23:50 2005
@@ -13,8 +13,13 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
+
 <html>
-	<body>
-		<p>An ApplicationException with errorCode=1 has occured. Handled by pipelines' error handler.</p>
-	</body>
-</html>
\ No newline at end of file
+  <body>
+    <p>
+      An <b>ApplicationException</b> with errorCode <b>1</b> has occured.
+      Handled by <code>map:pipelines</code> error handler in
+      <code>errorhandling/exception/sitemap.xmap</code>.
+    </p>
+  </body>
+</html>

Modified: cocoon/trunk/src/webapp/samples/errorhandling/exception/application2.htm
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/webapp/samples/errorhandling/exception/application2.htm?view=diff&r1=157099&r2=157100
==============================================================================
--- cocoon/trunk/src/webapp/samples/errorhandling/exception/application2.htm (original)
+++ cocoon/trunk/src/webapp/samples/errorhandling/exception/application2.htm Fri Mar 11 08:23:50 2005
@@ -13,8 +13,13 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
+
 <html>
-	<body>
-		<p>An ApplicationException with errorCode=2 has occured. Handled by pipelines' error handler.</p>
-	</body>
+  <body>
+    <p>
+      An <b>ApplicationException</b> with errorCode <b>2</b> has occured.
+      Handled by <code>map:pipelines</code> error handler in
+      <code>errorhandling/exception/sitemap.xmap</code>.
+    </p>
+  </body>
 </html>

Modified: cocoon/trunk/src/webapp/samples/errorhandling/exception/error-giving-page.xml
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/webapp/samples/errorhandling/exception/error-giving-page.xml?view=diff&r1=157099&r2=157100
==============================================================================
--- cocoon/trunk/src/webapp/samples/errorhandling/exception/error-giving-page.xml (original)
+++ cocoon/trunk/src/webapp/samples/errorhandling/exception/error-giving-page.xml Fri Mar 11 08:23:50 2005
@@ -15,8 +15,6 @@
   limitations under the License.
 -->
 
-<!-- CVS $Id: error-giving-page.xml,v 1.3 2004/03/06 02:26:04 antonio Exp $ -->
-
 <!DOCTYPE page [
  <!ELEMENT page (title?, content)>
  <!ELEMENT title (#PCDATA)>
@@ -24,11 +22,19 @@
  <!ELEMENT para (#PCDATA)>
 ]>
 
+<!--+
+    | Broken Page.
+    |
+    | NOTE: This page is intentionally not well-formed in order
+    |       to trigger an exception and show how the sitemap
+    |       error handling works!
+    |
+    | $Id$
+    +-->
+
 <page>
- <!-- NOTE: this page is not well-formed intentionally in order to trigger an exception
-      and show how the sitemap error handling works -->
- <title>Hello<title>
- <content>
-  <para>This is my first Cocoon page!</para>
- </content>
+  <title>Hello<title>
+  <content>
+    <para>This is my first Cocoon page!</para>
+  </content>
 </page>

Modified: cocoon/trunk/src/webapp/samples/errorhandling/exception/sitemap.xmap
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/webapp/samples/errorhandling/exception/sitemap.xmap?view=diff&r1=157099&r2=157100
==============================================================================
--- cocoon/trunk/src/webapp/samples/errorhandling/exception/sitemap.xmap (original)
+++ cocoon/trunk/src/webapp/samples/errorhandling/exception/sitemap.xmap Fri Mar 11 08:23:50 2005
@@ -15,26 +15,21 @@
   limitations under the License.
 -->
 
-<!-- CVS $Id: sitemap.xmap,v 1.7 2004/03/06 02:26:04 antonio Exp $ -->
-
+<!--+
+    |
+    | $Id$
+    +-->
 <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
 
-  <map:components>
-    <map:generators default="file">
-      <map:generator name="exception" src="org.apache.cocoon.samples.errorhandling.ExceptionGenerator"/>
-    </map:generators>
-  </map:components>
-
   <map:pipelines>
     <map:pipeline>
-
-      <map:match pattern="exception">
-        <map:generate type="exception"/>
+      <map:match pattern="generror">
+        <map:generate src="error-giving-page.xml"/>
         <map:serialize/>
       </map:match>
 
-      <map:match pattern="generror">
-        <map:generate src="error-giving-page.xml"/>
+      <map:match pattern="*">
+        <map:generate type="exception" src="{1}"/>
         <map:serialize/>
       </map:match>
 

Modified: cocoon/trunk/src/webapp/samples/errorhandling/exception/validation.htm
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/webapp/samples/errorhandling/exception/validation.htm?view=diff&r1=157099&r2=157100
==============================================================================
--- cocoon/trunk/src/webapp/samples/errorhandling/exception/validation.htm (original)
+++ cocoon/trunk/src/webapp/samples/errorhandling/exception/validation.htm Fri Mar 11 08:23:50 2005
@@ -13,8 +13,13 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
+
 <html>
-	<body>
-		<p>A ValidationException has occured. Handled by pipeline's error handler.</p>
-	</body>
-</html>
\ No newline at end of file
+  <body>
+    <p>
+      A <b>ValidationException</b> has occured.
+      Handled by <code>map:pipeline</code> error handler in
+      <code>errorhandling/exception/sitemap.xmap</code>.
+    </p>
+  </body>
+</html>

Copied: cocoon/trunk/src/webapp/samples/errorhandling/notFound.html (from r157096, cocoon/branches/BRANCH_2_1_X/src/webapp/samples/errorhandling/notFound.html)
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/webapp/samples/errorhandling/notFound.html?view=diff&rev=157100&p1=cocoon/branches/BRANCH_2_1_X/src/webapp/samples/errorhandling/notFound.html&r1=157096&p2=cocoon/trunk/src/webapp/samples/errorhandling/notFound.html&r2=157100
==============================================================================
    (empty)

Propchange: cocoon/trunk/src/webapp/samples/errorhandling/notFound.html
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: cocoon/trunk/src/webapp/samples/errorhandling/samples.xml
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/webapp/samples/errorhandling/samples.xml?view=diff&r1=157099&r2=157100
==============================================================================
--- cocoon/trunk/src/webapp/samples/errorhandling/samples.xml (original)
+++ cocoon/trunk/src/webapp/samples/errorhandling/samples.xml Fri Mar 11 08:23:50 2005
@@ -15,56 +15,71 @@
   limitations under the License.
 -->
 
-<!-- CVS $Id: samples.xml,v 1.5 2004/06/04 12:54:53 vgritsenko Exp $ -->
-
+<!--+
+    | $Id$
+    +-->
 <samples name="Error Handling Samples" xmlns:xlink="http://www.w3.org/1999/xlink">
 
   <group name="Back">
-   <sample name="Back" href="../">
-    Back to the samples home page.
-   </sample>
+    <sample name="Back" href="../">
+      Back to the samples home page.
+    </sample>
   </group>
 
   <group name="Cocoon Exceptions">
-   <note>Choose what exception you want to generate...</note>
-   <sample name="SAXParseException" href="exception/generror">
-    Attempt to read invalid XML file.
-   </sample>
-   <sample name="ValidationException" href="exception/exception?exception=validation">
-    Generate ValidationException.
-   </sample>
-   <sample name="ResourceNotFoundException" href="exception/exception?exception=resourceNotFound">
-    Generate ResourceNotFoundException.
-   </sample>
+    <note>Demonstrates common Cocoon exceptions and default error handling.</note>
+    <sample name="SAXParseException" href="exception/generror">
+      Attempt to read invalid XML file.
+    </sample>
+    <sample name="ResourceNotFoundException" href="not-exists">
+      Attempt to read non existent file.
+    </sample>
+    <sample name="ProcessingException" href="processing">
+      General processing error.
+    </sample>
+    <sample name="SAXException" href="sax">
+      SAX processing error.
+    </sample>
+    <sample name="Wrapped ProcessingException" href="saxWrapped">
+      General processing error wrapped in SAX exception.
+    </sample>
   </group>
 
-  <group name="Application Exceptions">
-   <sample name="ApplicationException (1)" href="exception/exception?exception=application&amp;code=1">
-    Generate ApplicationException with error code 1.
-   </sample>
-   <sample name="ApplicationException (2)" href="exception/exception?exception=application&amp;code=2">
-    Generate ApplicationException with error code 2.
-   </sample>
-   <sample name="ApplicationException (3)" href="exception/exception?exception=application&amp;code=3">
-    Generate ApplicationException with error code 3.
-   </sample>
+  <group name="Java Exceptions">
+    <note>Demonstrates common Java exceptions and default error handling.</note>
+    <sample name="NullPointerException" href="nullPointer">
+      Generate NullPointerException.
+    </sample>
+    <sample name="IOException" href="io">
+      Generate IOException.
+    </sample>
+    <note>
+      Since Cocoon does not process java.lang.Error (and derived objects),
+      behavior of this sample will depend on behavior of servlet engine.
+      In case of Jetty and Tomcat, they will show empty page and print
+      Error's stacktrace to the console.
+    </note>
+    <sample name="Error" href="exception/error">
+      Generate Error.
+    </sample>
   </group>
 
-  <group name="Java Exceptions">
-   <sample name="NullPointerException" href="exception/exception?exception=nullPointer">
-    Generate RuntimeException.
-   </sample>
-   <note>
-     Since Cocoon does not process java.lang.Error (and derived objects),
-     behavior of this sample will depend on behavior of servlet engine.
-     In case of Jetty and Tomcat, they will show empty page and print
-     Error's stacktrace to the console.
-   </note>
-   <sample name="Error" href="exception/exception?exception=error">
-    Generate Error.
-   </sample>
-   <sample name="No Exception" href="exception/exception">
-    Normal behaviour.
-   </sample>
+  <group name="Custom Exception Handling">
+    <note>Demonstrates custom error handling of Cocoon and Application exceptions.</note>
+    <sample name="ResourceNotFoundException" href="exception/notFound">
+      Generate ResourceNotFoundException.
+    </sample>
+    <sample name="ValidationException" href="exception/validation">
+      Generate ValidationException.
+    </sample>
+    <sample name="ApplicationException (1)" href="exception/application?code=1">
+      Generate ApplicationException with error code 1.
+    </sample>
+    <sample name="ApplicationException (2)" href="exception/application?code=2">
+      Generate ApplicationException with error code 2.
+    </sample>
+    <sample name="ApplicationException (3)" href="exception/application?code=3">
+      Generate ApplicationException with error code 3.
+    </sample>
   </group>
 </samples>

Modified: cocoon/trunk/src/webapp/samples/errorhandling/sitemap.xmap
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/webapp/samples/errorhandling/sitemap.xmap?view=diff&r1=157099&r2=157100
==============================================================================
--- cocoon/trunk/src/webapp/samples/errorhandling/sitemap.xmap (original)
+++ cocoon/trunk/src/webapp/samples/errorhandling/sitemap.xmap Fri Mar 11 08:23:50 2005
@@ -15,11 +15,15 @@
   limitations under the License.
 -->
 
-<!-- CVS $Id: sitemap.xmap,v 1.7 2004/03/06 02:26:18 antonio Exp $ -->
-
+<!--+
+    | $Id$
+    +-->
 <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
 
   <map:components>
+    <map:generators default="file">
+      <map:generator name="exception" src="org.apache.cocoon.samples.errorhandling.ExceptionGenerator"/>
+    </map:generators>
     <map:selectors default="browser">
       <map:selector name="exception" src="org.apache.cocoon.selection.XPathExceptionSelector">
         <exception name="application" class="org.apache.cocoon.samples.errorhandling.ApplicationException">
@@ -31,6 +35,9 @@
         <exception class="java.lang.Throwable" unroll="true"/>
       </map:selector>
     </map:selectors>
+    <map:actions>
+      <map:action name="exception" src="org.apache.cocoon.samples.errorhandling.ExceptionAction"/>
+    </map:actions>
   </map:components>
 
   <map:pipelines>
@@ -47,13 +54,19 @@
         <map:serialize/>
       </map:match>
 
-      <map:match pattern="main">
-        <map:generate src="main.xml"/>
-        <map:transform src="context://samples/common/style/xsl/html/complex-page2html.xsl">
-          <map:parameter name="contextPath" value="{request:contextPath}"/>
-        </map:transform>
+      <map:match pattern="not-exists">
+        <map:generate src="{0}.xml"/>
+        <map:serialize/>
+      </map:match>
+
+      <map:match pattern="*">
+        <map:generate type="exception" src="{1}"/>
         <map:serialize/>
       </map:match>
+
+      <map:match pattern="internal/**">
+        <map:mount uri-prefix="internal" src="internal/"/>
+      </map:match>
     </map:pipeline>
 
     <map:pipeline>
@@ -62,7 +75,7 @@
       <map:handle-errors>
         <map:select type="exception">
           <map:when test="not-found">
-            <map:generate src="resourceNotFound.htm"/>
+            <map:generate src="notFound.html"/>
             <map:serialize/>
           </map:when>
         </map:select>

Modified: cocoon/trunk/src/webapp/samples/samples.xml
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/webapp/samples/samples.xml?view=diff&r1=157099&r2=157100
==============================================================================
--- cocoon/trunk/src/webapp/samples/samples.xml (original)
+++ cocoon/trunk/src/webapp/samples/samples.xml Fri Mar 11 08:23:50 2005
@@ -18,7 +18,7 @@
 <!--+
     | Main samples page
     |
-    | CVS $Id: samples.xml,v 1.40 2004/05/24 01:48:24 crossley Exp $
+    | CVS $Id$
     +-->
 
 <samples name="Cocoon Samples" xmlns:xlink="http://www.w3.org/1999/xlink">
@@ -42,7 +42,7 @@
       languages. Here is an example of the power of such an approach with
       the help of those i18n and l10n Cocoon facilities.
     </sample>
-    <sample name="Syndication and Content Aggregation" href="aggregation/">
+    <sample name="Content Syndication &amp; Aggregation" href="aggregation/">
       Separation of content and style allows not only to serve your content
       in different ways, but also to syndicate, aggregate or otherwise include
       and transform content provided by other web sites.
@@ -67,7 +67,7 @@
       An example page producing exceptions and handling them. Demonstrates the 
       handler hierarchy and the exception selectors.
     </sample>
-    <sample href="components" name="Components">
+    <sample href="components" name="Core Components">
       Some samples of various components that are included with the core,
       e.g. Stream Generators, Paginator Transformers, Image Readers.
     </sample>