<?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
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You 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.
-->

<!--+
    | $Id: sitemap.xmap 433543 2006-08-22 06:22:54Z crossley $
    +-->
<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">
          <xpath name="application1" test="errorCode=1"/>
          <xpath name="application2" test="errorCode=2"/>
        </exception>
        <exception name="validation" class="org.apache.cocoon.samples.errorhandling.ValidationException"/>
        <exception name="not-found" class="org.apache.cocoon.ResourceNotFoundException"/>
        <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>
    <map:pipeline>
      <map:match pattern="">
        <map:redirect-to uri="welcome"/>
      </map:match>

      <map:match pattern="welcome">
        <map:generate src="samples.xml"/>
        <map:transform src="context://samples/common/style/xsl/html/simple-samples2html.xsl">
          <map:parameter name="contextPath" value="{request:contextPath}"/>
        </map:transform>
        <map:serialize/>
      </map:match>

      <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>
      <map:mount uri-prefix="exception" src="exception/"/>

      <map:handle-errors>
        <map:select type="exception">
          <map:when test="not-found">
            <map:generate src="notFound.html"/>
            <map:serialize/>
          </map:when>
        </map:select>
      </map:handle-errors>
    </map:pipeline>

    <map:handle-errors>
      <map:generate type="notifying"/>
      <map:transform src="context://stylesheets/system/error2html.xslt">
        <map:parameter name="contextPath" value="{request:contextPath}"/>
      </map:transform>
    </map:handle-errors>
  </map:pipelines>

</map:sitemap>
