<?xml version="1.0" encoding="UTF-8"?>
<!--

    The contents of this file are subject to the license and copyright
    detailed in the LICENSE and NOTICE files at the root of the source
    tree and available online at

    http://www.dspace.org/license/

-->
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
        <map:components>
                <map:generators default="file">
                        <map:generator label="content" logger="sitemap.generator.file" name="file" pool-max="32"
                                src="org.apache.cocoon.generation.FileGenerator"/>
                        <map:generator label="content" logger="sitemap.generator.directory" name="directory"
                                pool-max="16" src="org.apache.cocoon.generation.DirectoryGenerator"/>
                        <map:generator name="DSpaceFeedGenerator" src="org.dspace.app.xmlui.cocoon.DSpaceFeedGenerator"/>
                        <map:generator name="DSpaceMETSGenerator" src="org.dspace.app.xmlui.cocoon.DSpaceMETSGenerator"/>
                        <map:generator name="DSpaceOREGenerator" src="org.dspace.app.xmlui.cocoon.DSpaceOREGenerator"/>
                        <map:generator name="DescriptionOpenSearchGenerator" src="org.dspace.app.xmlui.opensearch.DescriptionOpenSearchGenerator"/>
                        <map:generator name="DiscoveryOpenSearchGenerator" src="org.dspace.app.xmlui.opensearch.DiscoveryOpenSearchGenerator"/>
                        <map:generator name="notifying" src="org.apache.cocoon.sitemap.NotifyingGenerator"/>
                        <map:generator name="exception" src="org.apache.cocoon.generation.ExceptionGenerator"/>
                        <map:generator name="AJAXMenuGenerator"
                             src="org.dspace.app.xmlui.cocoon.AJAXMenuGenerator"/>
                </map:generators>
                <map:serializers default="xml">
                        <map:serializer logger="sitemap.serializer.xml" mime-type="text/xml; charset=utf-8" name="xml"
                            src="org.apache.cocoon.serialization.XMLSerializer">
                            <indent>yes</indent>
                            <encoding>UTF-8</encoding>
                        </map:serializer>
                        <map:serializer name="rss" logger="sitemap.serializer.rss" mime-type="application/rss+xml; charset=utf-8"
                            src="org.apache.cocoon.serialization.XMLSerializer">
                            <indent>yes</indent>
                            <encoding>UTF-8</encoding>
                        </map:serializer>
                        <map:serializer name="atom" logger="sitemap.serializer.atom" mime-type="application/atom+xml; charset=utf-8"
                            src="org.apache.cocoon.serialization.XMLSerializer">
                            <indent>yes</indent>
                            <encoding>UTF-8</encoding>
                        </map:serializer>
                        <map:serializer name="opensearch" logger="sitemap.serializer.opensearch" mime-type="application/opensearchdescription+xml; charset=utf-8"
                            src="org.apache.cocoon.serialization.XMLSerializer">
                            <indent>yes</indent>
                            <encoding>UTF-8</encoding>
                        </map:serializer>
                        <map:serializer name="xhtml" logger="sitemap.serializer.xhtml"
                             src="org.apache.cocoon.serialization.XMLSerializer"
                             mime-type="text/html; charset=utf-8"
                             pool-grow="2" pool-max="64" pool-min="2">
                            <doctype-public>-//W3C//DTD XHTML 1.0 Strict//EN</doctype-public>
                            <doctype-system>http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd</doctype-system>
                            <encoding>UTF-8</encoding>
                            <indent>yes</indent>
                        </map:serializer>
                        <map:serializer name="html" logger="sitemap.serializer.html"
                             src="org.apache.cocoon.serialization.HTMLSerializer"
                             mime-type="text/html; charset=utf-8"
                             pool-grow="2" pool-max="64" pool-min="2">
                            <doctype-public>-//W3C//DTD XHTML 1.0 Transitional//EN</doctype-public>
                            <doctype-system>http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</doctype-system>
                            <encoding>UTF-8</encoding>
                            <indent>yes</indent>
                        </map:serializer>
                </map:serializers>
                <map:transformers default="xslt">
                        <map:transformer logger="sitemap.transformer.xslt" name="xslt" pool-max="32"
                                src="org.apache.cocoon.transformation.TraxTransformer">
                                <use-request-parameters>false</use-request-parameters>
                                <use-session-parameters>false</use-session-parameters>
                                <use-cookie-parameters>false</use-cookie-parameters>
                                <xslt-processor-role>xalan</xslt-processor-role>
                                <check-includes>true</check-includes>
                        </map:transformer>
                        <map:transformer name="i18n" src="org.dspace.app.xmlui.cocoon.DSpaceI18NTransformer">
                                <catalogues default="default">
                                        <catalogue id="default" name="messages" aspects="true">
                                                <location>context://i18n/</location>
                                                <!-- Two locations for each installed aspect will be installed, one inside
                                                         the aspect's directory and another inside the base location listed
                                                         above -->
                                        </catalogue>
                                </catalogues>
                                <untranslated-text>untranslated</untranslated-text>
                                <cache-at-startup>true</cache-at-startup>
                        </map:transformer>
                        <map:transformer name="SAXLogger" src="org.apache.cocoon.transformation.LogTransformer"/>
                        <map:transformer name="Include" src="org.dspace.app.xmlui.wing.Include"/>
                        <map:transformer name="IncludePageMeta" src="org.dspace.app.xmlui.wing.IncludePageMeta"/>
                        <map:transformer name="stylesheet" src="org.dspace.app.xmlui.cocoon.StylesheetInstructionTransformer"/>
                        <map:transformer name="PasswordLogin" src="org.dspace.app.xmlui.aspect.eperson.PasswordLogin"/>
                        <map:transformer name="LDAPLogin" src="org.dspace.app.xmlui.aspect.eperson.LDAPLogin"/>
                        <map:transformer name="notice" src="org.dspace.app.xmlui.aspect.general.NoticeTransformer"/>
                        <map:transformer name="NamespaceFilter" src="org.dspace.app.xmlui.cocoon.NamespaceFilterTransformer"/>
                        <map:transformer name="RestrictedItem" src="org.dspace.app.xmlui.aspect.artifactbrowser.RestrictedItem"/>
                </map:transformers>
                <map:matchers default="wildcard">
                        <map:matcher logger="sitemap.matcher.wildcard" name="wildcard"
                                src="org.apache.cocoon.matching.WildcardURIMatcher"/>
                        <map:matcher logger="sitemap.matcher.regexp" name="regexp"
                                src="org.apache.cocoon.matching.RegexpURIMatcher"/>
                        <map:matcher logger="sitemap.matcher.request-parameter" name="request-parameter"
                                src="org.apache.cocoon.matching.RequestParameterMatcher"/>
                        <map:matcher logger="sitemap.matcher.cookie" name="cookie"
                                src="org.apache.cocoon.matching.CookieMatcher"/>
                        <map:matcher logger="sitemap.matcher.header" name="header"
                                src="org.apache.cocoon.matching.HeaderMatcher"/>
                        <map:matcher logger="sitemap.matcher.parameter" name="parameter"
                                src="org.apache.cocoon.matching.ParameterMatcher"/>
                        <map:matcher name="WildcardParameterMatcher" src="org.apache.cocoon.matching.WildcardParameterMatcher"/>
                        <map:matcher logger="sitemap.matcher.sessionstate" name="sessionstate"
                                src="org.apache.cocoon.matching.WildcardSessionAttributeMatcher">
                                <attribute-name>org.apache.cocoon.SessionState</attribute-name>
                        </map:matcher>
                        <map:matcher logger="sitemap.matcher.referer-match" name="referer-match"
                                src="org.apache.cocoon.matching.WildcardHeaderMatcher">
                                <header-name>referer</header-name>
                        </map:matcher>
                        <map:matcher name="mount-table" src="org.apache.cocoon.matching.MountTableMatcher">
                                <map:parameter name="ignore-missing-tables" value="true"/>
                        </map:matcher>
                        <map:matcher name="request" src="org.apache.cocoon.matching.RequestParameterMatcher"/>
                        <map:matcher name="StatisticsAuthorizedMatcher" src="org.dspace.app.xmlui.aspect.statistics.StatisticsAuthorizedMatcher"/>
                </map:matchers>
                <map:selectors>
                        <map:selector name="browser" src="org.apache.cocoon.selection.BrowserSelector"
                                logger="sitemap.selector.browser">
                                <!-- Identify web-crawling robots (spiders)
                                   - to support if-modified-since protocol, but not on browsers
                                   - because it would let pages that depend on authorization get cached.
                                   - List these first since may spiders also include browser signatures in their user-agent strings.
                                  -->
                                <browser name="spider" useragent="Googlebot"/>
                                <browser name="spider" useragent="msnbot"/>
                                <browser name="spider" useragent="Yahoo! Slurp"/>
                                <browser name="spider" useragent="Y!J"/>
                                <browser name="spider" useragent="Yahoo Pipes"/>
                                <browser name="spider" useragent="YahooCacheSystem"/>
                                <browser name="spider" useragent="Ask Jeeves"/>
                                <browser name="spider" useragent="FAST Enterprise Crawle"/>
                                <browser name="spider" useragent="Ultraseek"/>
                                <browser name="spider" useragent="Baiduspider"/>
                                <browser name="spider" useragent="yacybot"/>
                                <browser name="spider" useragent="gsa-crawler"/>

                                <!-- Interactive browsers -->
                                <browser name="opera" useragent="Opera"/>
                                <browser name="opera8" useragent="Opera/8."/>
                                <browser name="opera9" useragent="Opera/9."/>
                                <!-- Yes, Opera 10, really identifies itself as "9.8" -->
                                <browser name="opera10" useragent="Opera/9.8"/>
                                <browser name="explorer" useragent="MSIE"/>
                                <browser name="explorer6" useragent="MSIE 6"/>
                                <browser name="explorer7" useragent="MSIE 7"/>
                                <browser name="explorer8" useragent="MSIE 8"/>
                                <browser name="explorer9" useragent="MSIE 9"/>
                                <browser name="chrome" useragent="Chrome"/>
                                <browser name="chrome4" useragent="Chrome/4."/>
                                <browser name="chrome5" useragent="Chrome/5."/>
                                <browser name="chrome6" useragent="Chrome/6."/>
                                <browser name="safari" useragent="Safari"/>
                                <browser name="safari2" useragent="(KHTML, like Gecko) Safari"/>
                                <browser name="safari3" useragent="(KHTML, like Gecko) Version/3"/>
                                <browser name="safari4" useragent="(KHTML, like Gecko) Version/4"/>
                                <browser name="safari5" useragent="(KHTML, like Gecko) Version/5"/>
                                <browser name="firefox" useragent="Firefox"/>
                                <browser name="firefox1" useragent="Firefox/1."/>
                                <browser name="firefox2" useragent="Firefox/2."/>
                                <browser name="firefox3" useragent="Firefox/3."/>
                                <browser name="firefox4" useragent="Firefox/4."/>
                                <browser name="konqueror" useragent="Konqueror/"/>
                        </map:selector>
                        <map:selector name="parameter" src="org.apache.cocoon.selection.ParameterSelector"/>
                        <map:selector logger="sitemap.selector.exception" name="exception" src="org.apache.cocoon.selection.ExceptionSelector">
                                <exception name="not-found" class="org.apache.cocoon.ResourceNotFoundException"/>
                                <exception name="invalid-continuation" class="org.apache.cocoon.components.flow.InvalidContinuationException"/>
                                <exception name="bad-request" class="org.dspace.app.xmlui.utils.BadRequestException"/>
                                <!-- The statement below tells the selector to unroll as much exceptions as possible -->
                                <exception class="java.lang.Throwable" unroll="true"/>
                        </map:selector>
                        <!-- AuthenticatedSelector for forcing user to login if not authorized - PMD -->
                        <map:selector name="AuthenticatedSelector" src="org.dspace.app.xmlui.aspect.general.AuthenticatedSelector"/>
                </map:selectors>
                <map:readers default="resource">
                    <map:reader name="resource" src="org.dspace.app.xmlui.cocoon.SafeResourceReader"
                            logger="sitemap.reader.resource" pool-max="32">
                            <expires>3600000</expires> <!-- 1000 * 60 * 60 = 3600000 = One hour -->
                    </map:reader>
                    <map:reader name="ThemeResourceReader" src="org.dspace.app.xmlui.cocoon.ThemeResourceReader"/>
                    <map:reader name="BitstreamReader" src="org.dspace.app.xmlui.cocoon.BitstreamReader"/>
                    <map:reader name="ExportReader" src="org.dspace.app.xmlui.cocoon.ItemExportDownloadReader"/>
                    <map:reader name="MetadataExportReader" src="org.dspace.app.xmlui.cocoon.MetadataExportReader"/>
                    
                    <map:reader name="SearchMetadataExportReader" src="org.dspace.app.xmlui.cocoon.SearchMetadataExportReader"/>
					
                    <map:reader name="CSVOutputter" src="org.dspace.app.xmlui.aspect.statisticsElasticSearch.CSVOutputter"/>

                    <map:reader name="OpenURLReader" src="org.dspace.app.xmlui.cocoon.OpenURLReader"/>
                    <map:reader name="SitemapReader" src="org.dspace.app.xmlui.cocoon.SitemapReader"/>
                    <map:reader name="ConcatenationReader" src="org.dspace.app.xmlui.cocoon.ConcatenationReader"/>
                    <map:reader name="JQueryLoaderReader" src="org.dspace.app.xmlui.utils.JQueryLoaderReader"/>
                    <map:reader name="JSONControlledVocabularyReader" src="org.dspace.app.xmlui.cocoon.JSONControlledVocabularyReader"/>
                                        
                    <map:reader name="HandleResolverReader" src="org.dspace.app.xmlui.aspect.handle.HandleResolverReader"/>
                </map:readers>
                <map:actions>
                        <map:action name="locale" src="org.dspace.app.xmlui.cocoon.DSpaceLocaleAction"/>
                        <map:action name="StartAuthentication" src="org.dspace.app.xmlui.aspect.eperson.StartAuthenticationAction"/>
                        <map:action name="DSpacePropertyFileReader" src="org.dspace.app.xmlui.cocoon.DSpacePropertyFileReader" />
                        <map:action name="PropertyFileReader" src="org.dspace.app.xmlui.cocoon.PropertyFileReader" />
                        <map:action name="ContextAbortAction" src="org.dspace.app.xmlui.cocoon.ContextAbortAction" />
                </map:actions>
                <map:pipes default="caching">
                        <map:pipe name="noncaching" src="org.apache.cocoon.components.pipeline.impl.NonCachingProcessingPipeline">
                        </map:pipe>
                        <map:pipe name="caching" src="org.apache.cocoon.components.pipeline.impl.CachingProcessingPipeline">
                        </map:pipe>
                </map:pipes>
        </map:components>

        <map:resources>


                <map:resource name="i18n-transformer">
                        <map:act type="locale">
                                <map:transform type="i18n">
                                        <map:parameter name="locale" value="{locale}"/>
                                </map:transform>
                        </map:act>
                </map:resource>

        </map:resources>


        <!-- =========================== Pipelines ================================= -->
        <map:pipelines>


                <!-- Bitstream pipeline -->
                <map:pipeline type="noncaching">
                        <map:parameter name="outputBufferSize" value="8192"/>
                        <map:parameter name="expires" value="now"/>


                        <!--
                                Bitstreams for items that have a handle assigned. If the
                                sequence parameter is given then that will be used to resolve the
                                bitstream, other wise the name will attempt to be matched.

                                /bitstream/handle/[handlePrefix]/[handlePostfix]/[name]?sequence=[sequence]

                                NOTE: When user-agent was identified as a spider (crawler robot), pass
                                that on to the generator so it can implement If-Modified-Since protocol.
                        -->
                        <map:match pattern="bitstream/handle/*/*/**">
                                <map:match type="request-parameter" pattern="sequence">
                                        <map:select type="browser">
                                          <map:when test="spider">
                                            <map:read type="BitstreamReader">
                                                    <map:parameter name="userAgent" value="spider"/>
                                                    <map:parameter name="handle" value="{../1}/{../2}"/>
                                                    <map:parameter name="name" value="{../3}"/>
                                                    <map:parameter name="sequence" value="{1}"/>
                                            </map:read>
                                          </map:when>
                                          <map:otherwise>
                                            <map:read type="BitstreamReader">
                                                    <map:parameter name="handle" value="{../1}/{../2}"/>
                                                    <map:parameter name="name" value="{../3}"/>
                                                    <map:parameter name="sequence" value="{1}"/>
                                            </map:read>
                                          </map:otherwise>
                                        </map:select>
                                </map:match>
                                <!-- otherwise, call without sequence parameter -->
                                <map:select type="browser">
                                  <map:when test="spider">
                                    <map:read type="BitstreamReader">
                                            <map:parameter name="userAgent" value="spider"/>
                                            <map:parameter name="handle" value="{1}/{2}"/>
                                            <map:parameter name="name" value="{3}"/>
                                    </map:read>
                                  </map:when>
                                  <map:otherwise>
                                    <map:read type="BitstreamReader">
                                            <map:parameter name="handle" value="{1}/{2}"/>
                                            <map:parameter name="name" value="{3}"/>
                                    </map:read>
                                  </map:otherwise>
                                </map:select>
                        </map:match>

                        <!--
                                Bitstreams for items that do not have a handle assigned. If the
                                sequence parameter is given then that will be used to resolve the
                                bitstream, other wise the name will attempt to be matched.

                                /bitstream/item/[itemID]/[name]?sequence=[sequence]
                        -->
                        <map:match pattern="bitstream/item/*/**">
                                <map:match type="request-parameter" pattern="sequence">
                                  <map:select type="browser">
                                    <map:when test="spider">
                                      <map:read type="BitstreamReader">
                                              <map:parameter name="userAgent" value="spider"/>
                                              <map:parameter name="itemID" value="{../1}"/>
                                              <map:parameter name="name" value="{../2}"/>
                                              <map:parameter name="sequence" value="{1}"/>
                                      </map:read>
                                    </map:when>
                                    <map:otherwise>
                                      <map:read type="BitstreamReader">
                                              <map:parameter name="itemID" value="{../1}"/>
                                              <map:parameter name="name" value="{../2}"/>
                                              <map:parameter name="sequence" value="{1}"/>
                                      </map:read>
                                    </map:otherwise>
                                  </map:select>
                                </map:match>
                                <map:select type="browser">
                                  <map:when test="spider">
                                    <map:read type="BitstreamReader">
                                            <map:parameter name="userAgent" value="spider"/>
                                            <map:parameter name="itemID" value="{1}"/>
                                            <map:parameter name="name" value="{2}"/>
                                    </map:read>
                                  </map:when>
                                  <map:otherwise>
                                    <map:read type="BitstreamReader">
                                            <map:parameter name="itemID" value="{1}"/>
                                            <map:parameter name="name" value="{2}"/>
                                    </map:read>
                                  </map:otherwise>
                                </map:select>
                        </map:match>

                        <!--
                                Bitstreams not attached to to items (community / collection logos)
                                
                                /bitstream/id/[bitstreamID]/[ignored]
                        -->
                        <map:match pattern="bitstream/id/*/**">
                                <map:select type="browser">
                                  <map:when test="spider">
                                    <map:read type="BitstreamReader">
                                            <map:parameter name="userAgent" value="spider"/>
                                            <map:parameter name="bitstreamID" value="{1}"/>
                                    </map:read>
                                  </map:when>
                                  <map:otherwise>
                                    <map:read type="BitstreamReader">
                                            <map:parameter name="bitstreamID" value="{1}"/>
                                    </map:read>
                                  </map:otherwise>
                                </map:select>
                        </map:match>


                        <!--
                                For URL compatibility with the JSPUI, redirect these old url to their new locations.

                                /bitstream/[handlePrefix]/[handlePostfix]/[sequence]/[name]
                                /html/[handlePrefix]/[handePostfix]/[name]
                                /retrieve/[bitstreamID]
                        -->
                        <map:match pattern="bitstream/*/*/*/**">
                                <map:redirect-to uri="{request:contextPath}/bitstream/handle/{1}/{2}/{4}?sequence={3}" permanent="yes"/>
                        </map:match>
                        <map:match pattern="html/*/*/**">
                                <map:redirect-to uri="{request:contextPath}/bitstream/handle/{1}/{2}/{3}" permanent="yes"/>
                        </map:match>
                        <map:match pattern="retrieve/**">
                                <map:redirect-to uri="{request:contextPath}/bitstream/id/{1}/" permanent="yes"/>
                        </map:match>
                        <!--Redirect /handle/[handleprefix]/[handlePostfix]/ to the same path but without a trailing slash-->
                        <map:match pattern="handle/*/*/">
                                <map:redirect-to uri="{request:contextPath}/handle/{1}/{2}" permanent="yes"/>
                        </map:match>
                        <!--
                                Downloads for the package download export
                        -->
                        <map:match pattern="exportdownload/*">
                                <map:read type="ExportReader">
                                        <map:parameter name="fileName" value="{1}"/>
                                </map:read>
                        </map:match>

                        <map:match pattern="csv/handle/*/*">
                                <map:read type="MetadataExportReader">
                                    <map:parameter name="handle" value="{1}/{2}" />
                                </map:read>
                        </map:match>
                        
                        <map:match pattern="discover/search/csv">
                                <map:read type="SearchMetadataExportReader"/>
                        </map:match>
						
                        <map:match pattern="handle/*/*/stats/csv">
                            <map:match type="StatisticsAuthorizedMatcher" pattern="READ">
                                <map:read type="CSVOutputter"/>
                            </map:match>

                            <map:match type="StatisticsAuthorizedMatcher" pattern="!READ">
                                <map:select type="AuthenticatedSelector">
                                    <map:when test="eperson">
                                        <map:transform type="RestrictedItem"/>
                                        <map:serialize/>
                                    </map:when>
                                    <map:otherwise>
                                        <map:act type="StartAuthentication">
                                            <map:parameter name="header" value="xmlui.ArtifactBrowser.RestrictedItem.auth_header"/>
                                            <map:parameter name="message" value="xmlui.ArtifactBrowser.RestrictedItem.auth_message"/>
                                        </map:act>
                                        <map:serialize/>
                                    </map:otherwise>
                                </map:select>
                            </map:match>
                        </map:match>

                        <map:match pattern="handle/*/*/stats/csv/*">
                            <map:match type="StatisticsAuthorizedMatcher" pattern="READ">
                                <map:read type="CSVOutputter"/>
                            </map:match>

                            <map:match type="StatisticsAuthorizedMatcher" pattern="!READ">
                                <map:select type="AuthenticatedSelector">
                                    <map:when test="eperson">
                                        <map:transform type="RestrictedItem"/>
                                        <map:serialize/>
                                    </map:when>
                                    <map:otherwise>
                                        <map:act type="StartAuthentication">
                                            <map:parameter name="header" value="xmlui.ArtifactBrowser.RestrictedItem.auth_header"/>
                                            <map:parameter name="message" value="xmlui.ArtifactBrowser.RestrictedItem.auth_message"/>
                                        </map:act>
                                        <map:serialize/>
                                    </map:otherwise>
                                </map:select>
                            </map:match>
                        </map:match>

                        <map:match pattern="JSON/discovery/**">
                            <map:mount check-reload="no" src="aspects/json-solr.xmap" uri-prefix="JSON/discovery/"/>
                        </map:match>

                        <map:match pattern="JSON/controlled-vocabulary">
                            <map:read type="JSONControlledVocabularyReader"/>
                        </map:match>
            <map:match pattern="json/submissionLookup">
                <map:mount check-reload="no" src="aspects/json-lookup.xmap" uri-prefix="json/"/>
            </map:match>
                </map:pipeline>

                <!-- new AJAX menu (choices) responses for metadata authority control -->
                <map:pipeline type="noncaching">
                  <map:match pattern="choices/*">
                      <map:act type="locale"/>
                      <!-- XXX bug: how do we get this locale into a parameter? -->
                        <map:generate type="AJAXMenuGenerator">
                          <map:parameter name="field" value="{1}"/>
                          <map:parameter name="query" value="{request-param:query}"/>
                          <map:parameter name="collection" value="{request-param:collection}"/>
                          <map:parameter name="start" value="{request-param:start}"/>
                          <map:parameter name="limit" value="{request-param:limit}"/>
                          <map:parameter name="format" value="{request-param:format}"/>
                          <map:parameter name="locale" value="{request-param:locale}"/>
                        </map:generate>
                        <map:serialize type="xml"/>
                     <!-- </map:match>
                         -->
                  </map:match>
                </map:pipeline>




                <!-- non-bitstream pipeline -->
                <map:pipeline>
                        <!--<map:parameter name="expires" value="now"/>-->

                    <map:match pattern="openURL">
                        <map:read type="OpenURLReader"/>
                    </map:match>

                    <!--
                        catch mydspace uri's and immediately redirect
                        to "submissions" this is a fix to catch approval
                        emails "mydspace" linking from Workflow system.
                    -->
                    <map:match pattern="mydspace">
                        <map:redirect-to uri="submissions" permanent="yes" />
                    </map:match>

                    <!-- Theme pipeline -->
                    <map:match pattern="DRI/**">
                        <map:mount check-reload="no" src="aspects/aspects.xmap" uri-prefix="DRI/"/>
                    </map:match>


                    <map:match pattern="metadata/**">
                        <map:match pattern="metadata/handle/*/*/mets.xml">
                                <map:generate type="DSpaceMETSGenerator">
                                        <map:parameter name="handle" value="{1}/{2}"/>
                                        <!--<map:parameter name="extra" value="{3}"/>-->
                                </map:generate>
                                <map:serialize type="xml"/>
                        </map:match>
                        <map:match pattern="metadata/internal/*/*/mets.xml">
                                <map:generate type="DSpaceMETSGenerator">
                                        <map:parameter name="internal" value="{1}:{2}"/>
                                        <!--<map:parameter name="extra" value="{3}"/>-->
                                </map:generate>
                                <map:serialize type="xml"/>
                        </map:match>

                        <map:match pattern="metadata/handle/*/*/ore.xml**">
                                <map:generate type="DSpaceOREGenerator">
                                        <map:parameter name="handle" value="{1}/{2}"/>
                                        <map:parameter name="extra" value="{3}"/>
                                </map:generate>
                                <map:serialize type="xml"/>
                        </map:match>
                        <map:match pattern="metadata/internal/*/*/ore.xml**">
                                <map:generate type="DSpaceOREGenerator">
                                        <map:parameter name="internal" value="{1}:{2}"/>
                                        <map:parameter name="extra" value="{3}"/>
                                </map:generate>
                                <map:serialize type="xml"/>
                        </map:match>
                    </map:match>

                    <!-- Syndication feeds for whole repo or community/collection -->
                    <map:match pattern="feed/*/**">
                        <map:generate type="DSpaceFeedGenerator">
                            <map:parameter name="feedFormat" value="{1}"/>
                            <map:parameter name="handle" value="{2}"/>
                        </map:generate>
                        <map:act type="locale">
                            <map:transform type="i18n">
                                    <map:parameter name="locale" value="{locale}"/>
                            </map:transform>
                        </map:act>
                        <map:serialize type="xml"/>
                    </map:match>

                    <!-- OpenSearch description document for whole repo or community/collection -->
                    <map:match pattern="open-search/description.xml">
                        <map:generate type="DescriptionOpenSearchGenerator"/>
                        <map:serialize type="opensearch"/>
                    </map:match>

                    <!-- OpenSearch results document for whole repo or community/collection -->
                    <map:match pattern="open-search/**">
                       <!-- Prior to DSpace 6.0, "open-search/" was mapped to the StandardOpenSearchGenerator,
                            which was removed as part of removal of the legacy Lucene search index classes.
                            This pattern has been removed to DiscoveryOpenSearchGenerator to help ensure
                            minimal impact from removal of the legacy Lucene search index. -->
                        <map:match pattern="open-search/">
                            <map:generate type="DiscoveryOpenSearchGenerator"/>
                        </map:match>

                        <map:match pattern="open-search/discover">
                            <map:generate type="DiscoveryOpenSearchGenerator"/>
                        </map:match>

                        <map:act type="locale">
                            <map:transform type="i18n">
                                <map:parameter name="locale" value="{locale}"/>
                            </map:transform>
                        </map:act>

                        <map:select type="request-parameter">
                            <map:parameter name="parameter-name" value="format"/>
                            <map:when test="rss">
                                <map:serialize type="rss"/>
                            </map:when>
                            <map:when test="atom">
                                <map:serialize type="atom"/>
                            </map:when>
                            <map:otherwise>
                                <map:serialize type="xml"/>
                            </map:otherwise>
                        </map:select>
                    </map:match>

                    <!-- HTML Sitemaps and Sitemaps.org Sitemaps for whole repo -->
                    <map:match pattern="htmlmap">
                        <map:read type="SitemapReader">
                            <map:parameter name="type" value="html"/>
                        </map:read>
                    </map:match>
                    <map:match pattern="sitemap">
                        <map:read type="SitemapReader">
                            <map:parameter name="type" value="sitemaps.org"/>
                        </map:read>
                    </map:match>

                    <map:match pattern="loadJQuery.js">
                        <map:read type="JQueryLoaderReader"/>
                    </map:match>

                    <!-- handle static js and css -->
                    <map:match pattern="themes/*.js">
                            <map:read type="ConcatenationReader" src="{1}.js">
                                <map:parameter name="requestQueryString" value="{request:queryString}"/>
                            </map:read>
                    </map:match>
                    <map:match pattern="themes/*.css">
                            <map:read type="ConcatenationReader" src="{1}.css">
                                <map:parameter name="requestQueryString" value="{request:queryString}"/>
                            </map:read>
                    </map:match>
                    <map:match pattern="themes/*.json">
                            <map:read type="ConcatenationReader" src="{1}.json">
                                <map:parameter name="requestQueryString" value="{request:queryString}"/>
                            </map:read>
                    </map:match>

                    <!-- handle static js and css -->
                    <map:match pattern="static/**.js">
                            <map:read type="ConcatenationReader" src="static/{1}.js">
                                <map:parameter name="requestQueryString" value="{request:queryString}"/>
                            </map:read>
                    </map:match>
                    <map:match pattern="static/**.css">
                            <map:read type="ConcatenationReader" src="static/{1}.css">
                                <map:parameter name="requestQueryString" value="{request:queryString}"/>
                            </map:read>
                    </map:match>
                    <map:match pattern="static/**.json">
                            <map:read type="ConcatenationReader" src="static/{1}.json">
                                <map:parameter name="requestQueryString" value="{request:queryString}"/>
                            </map:read>
                    </map:match>

                    <!-- Redirect / block for DS-3094 (security issue) for custom themes -->
                    <!-- This ensures any custom themes are not affected by DS-3094 by redirecting
                         vulnerable URL paths to /error (which returns a 404 File Not Found).
                         Custom themes may still be affected by this issue, if they have not
                         been updated to use ThemeResourceReader in all <map:read> settings. -->
                    <map:match pattern="themes/**:**">
                        <map:redirect-to uri="{request:contextPath}/error" permanent="yes"/>
                    </map:match>

                    <!-- handle common theme resources, such as dri2xhtml -->
                    <map:match pattern="themes/*">
                        <map:read type="ThemeResourceReader" src="themes/{1}"/>
                    </map:match>

                    <!-- handle theme specific resources static or dynamic -->
                    <map:match pattern="themes/*/**">
                        <map:mount check-reload="no" src="themes/{1}/sitemap.xmap" uri-prefix=""/>
                    </map:match>

                    <!-- Load globally static content (*.txt or *.html) when requested.
                       This is specifically for global HTML files or robots.txt files,
                       either of which can be placed in the 'static/' directory.-->
                    <map:match pattern="*.txt">
                        <map:read src="static/{1}.txt"/>
                    </map:match>
                    <map:match pattern="*.html">
                        <map:read src="static/{1}.html"/>
                    </map:match>
                    <!-- Also, allow reference to globally static content via the /static path.
                        This will allow your globally static HTML docs to load static CSS or images. -->
                    <map:match pattern="static/*/**">
                        <map:read src="static/{1}/{2}"/>
                    </map:match>

                    <!-- DSpace does not have any paths beginning with numbers (0-9). If one is accessed,
                         assume that it is an identifier & redirect it. This also avoids an internal
                         error, where the XMLUI AspectMatcher wrongly assumes numbers at beginning
                         of path are direct references to individual Aspects in the aspect chain.-->
                    <map:match type="regexp" pattern="(^[0-9]+\/?.*$)">
                        <map:redirect-to uri="{request:contextPath}/handle/{1}" permanent="yes"/>
                    </map:match>

                </map:pipeline>
                
                <!-- pipline to run external handle server -->
                <map:pipeline type="noncaching">
                  <map:match pattern="handleresolver/resolve/**">
                        <map:read type="HandleResolverReader">
                            <map:parameter name="action" value="resolve"/>
                            <map:parameter name="handle" value="{1}"/>
                      </map:read>
                  </map:match>

                  <!--Redirect /handleresolver/listprefixes/ to the same path but without a trailing slash-->
                  <map:match pattern="handleresolver/listprefixes/">
                      <map:redirect-to uri="{request:contextPath}/handleresolver/listprefixes" permanent="yes"/>
                  </map:match>
                  <map:match pattern="handleresolver/listprefixes">
                      <map:read type="HandleResolverReader">
                            <map:parameter name="action" value="listprefixes"/>
                      </map:read>
                  </map:match>

                  <map:match pattern="handleresolver/listhandles/*">
                      <map:read type="HandleResolverReader">
                            <map:parameter name="action" value="listhandles"/>
                            <map:parameter name="prefix" value="{1}"/>
                      </map:read>
                  </map:match>
                </map:pipeline>
                
                <map:pipeline>
                        <!--<map:match pattern="**">-->
                        <map:mount check-reload="no" src="themes/themes.xmap" uri-prefix=""/>
                        <!--</map:match>-->
                </map:pipeline>

                <map:handle-errors>
                        <map:select type="exception">

                                <map:when test="bad-request">
                                        <map:generate type="exception"/>
                                        <map:transform src="exception2html.xslt">
                                                <map:parameter name="contextPath" value="{request:contextPath}"/>
                                                <map:parameter name="pageTitle" value="Bad request"/>
                                        </map:transform>
                                        <map:act type="locale">
                                            <map:transform type="i18n">
                                                    <map:parameter name="locale" value="{locale}"/>
                                            </map:transform>
                                        </map:act>
                                        <map:serialize type="xhtml" status-code="400"/>
                                </map:when>

                                <map:when test="not-found">
                                        <map:generate type="exception"/>
                                        <map:transform src="exception2html.xslt">
                                                <map:parameter name="contextPath" value="{request:contextPath}"/>
                                                <map:parameter name="pageTitle" value="Resource not found"/>
                                        </map:transform>
                                        <map:act type="locale">
                                            <map:transform type="i18n">
                                                    <map:parameter name="locale" value="{locale}"/>
                                            </map:transform>
                                        </map:act>
                                        <map:serialize type="xhtml" status-code="404"/>
                                </map:when>

                                <map:when test="invalid-continuation">
                                        <map:generate type="exception"/>
                                        <map:transform src="exception2html.xslt">
                                                <map:parameter name="contextPath" value="{request:contextPath}"/>
                                                <map:parameter name="pageTitle" value="Your Session has Expired"/>
                                        </map:transform>
                                        <map:act type="locale">
                                            <map:transform type="i18n">
                                                    <map:parameter name="locale" value="{locale}"/>
                                            </map:transform>
                                        </map:act>
                                        <map:serialize type="xhtml" status-code="404"/>
                                </map:when>

                                <map:otherwise>
                                    <map:act type="ContextAbortAction"/>

                                    <map:generate type="exception"/>
                                        <map:transform src="exception2html.xslt">
                                                <map:parameter name="contextPath" value="{request:contextPath}"/>
                                        </map:transform>
                                        <map:act type="locale">
                                            <map:transform type="i18n">
                                                    <map:parameter name="locale" value="{locale}"/>
                                            </map:transform>
                                        </map:act>
                                        <map:serialize type="xhtml" status-code="500"/>
                                </map:otherwise>
                        </map:select>
                </map:handle-errors>
        </map:pipelines>
</map:sitemap>


