<?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/

-->
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

    <display-name>Manakin</display-name>

    <description>
        An XML based front end to DSpace that allows thematic
        customizations to DSpace's interface.
    </description>

    <!-- Context Configuration ========================================== -->

    <!--+
        | Set a context property useful to allow you to ProxyPass your
        | web application mounted to a different URI without loosing the
        | ability to do cookie-based sessions.
        | WARNING: this is Jetty specific!
        +-->
    <!--context-param>
        <param-name>org.mortbay.jetty.servlet.SessionPath</param-name>
        <param-value>/some/path/to/your/webapp</param-value>
        <description>An override of the session cookie path</description>
        </context-param-->

  <!-- ConfigurationService initialization for dspace.dir -->
  <context-param>
    <description>
      The location of the DSpace home directory
    </description>
    <param-name>dspace.dir</param-name>
    <param-value>${dspace.dir}</param-value>
  </context-param>
  
  <!--  configures the locations that Spring configurations are searched for. -->
  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/spring/*.xml</param-value>
  </context-param>
  
  <!--
    - Use the Cocoon debug filter together with the Cocoon demo webapp
  <filter-mapping>
    <filter-name>CocoonDebugFilter</filter-name>
    <servlet-name>Cocoon</servlet-name>
  </filter-mapping>
    -->


  <!--
    - Declare a filter for multipart MIME handling
    -->
  <filter>
    <description>Multipart MIME handling filter for Cocoon</description>
    <display-name>Cocoon multipart filter</display-name>
    <filter-name>CocoonMultipartFilter</filter-name>
    <filter-class>org.dspace.app.xmlui.cocoon.servlet.multipart.DSpaceMultipartFilter</filter-class>
  </filter>

  <!--
    - Declare a filter for debugging incoming request
    -->
    
  <!-- session/request filter (from util), handles setting up requests and sessions correctly -->
  <filter>
    <filter-name>dspace.request</filter-name>
    <filter-class>org.dspace.utils.servlet.DSpaceWebappServletFilter</filter-class>
  </filter>
  
  <filter>
    <description>Log debug information about each request</description>
    <display-name>Cocoon debug filter</display-name>
    <filter-name>CocoonDebugFilter</filter-name>
    <filter-class>org.apache.cocoon.servlet.DebugFilter</filter-class>
  </filter>
  
   <filter>
    <description>Log debug information about each request</description>
    <display-name>Cocoon debug filter</display-name>
    <filter-name>DSpaceCocoonServletFilter</filter-name>
    <filter-class>org.dspace.app.xmlui.cocoon.DSpaceCocoonServletFilter</filter-class>
  </filter>

  <!--
    - Declare a filter to force UTF-8 encoding for all servlet requests
    -->
  <filter>
    <filter-name>SetCharacterEncoding</filter-name>
    <filter-class>org.dspace.app.xmlui.cocoon.SetCharacterEncodingFilter</filter-class>
    <init-param>
      <param-name>encoding</param-name>
      <param-value>UTF-8</param-value>
    </init-param>
  </filter>

  <!--
       Declare a filter to do content negotiation in combination for our
       Linked Data support.
    -->
  <filter>
      <filter-name>rdf-content-negotiation</filter-name>
      <filter-class>org.dspace.rdf.negotiation.NegotiationFilter</filter-class>
  </filter>


  <!-- Filter mappings ================================================ -->

  <!-- Filter mappings -->
  <filter-mapping>
        <filter-name>dspace.request</filter-name>
        <url-pattern>/*</url-pattern>
  </filter-mapping>
  
  <!--
    - Use the Cocoon multipart filter together with the Cocoon demo webapp
    -->
  <filter-mapping>
    <filter-name>CocoonMultipartFilter</filter-name>
    <servlet-name>spring</servlet-name>
  </filter-mapping>

  <filter-mapping>
    <filter-name>DSpaceCocoonServletFilter</filter-name>
    <servlet-name>spring</servlet-name>
  </filter-mapping>

  <filter-mapping>
    <filter-name>SetCharacterEncoding</filter-name>
    <servlet-name>spring</servlet-name>
  </filter-mapping>

  <filter-mapping>
      <filter-name>rdf-content-negotiation</filter-name>
      <url-pattern>/handle/*</url-pattern>
  </filter-mapping>
  
  <!--
    - Use the Cocoon debug filter together with the Cocoon demo webapp
  <filter-mapping>
    <filter-name>CocoonDebugFilter</filter-name>
    <servlet-name>Cocoon</servlet-name>
  </filter-mapping>
    -->

  <!-- Servlet Context Listener ======================================= -->
    <!-- Listener to initialize / clean up the application -->
    <listener>
        <listener-class>org.dspace.app.util.DSpaceContextListener</listener-class>
    </listener>

    <!-- kernel start listener (from impl), starts up the kernel for standalong webapps -->
  <listener>
     <listener-class>org.dspace.servicemanager.servlet.DSpaceKernelServletContextListener</listener-class>
  </listener>

    <listener>
        <listener-class>org.dspace.app.util.DSpaceWebappListener</listener-class>
    </listener>

  
    <!-- Listener to clean up Commons-FileUpload -->
    <listener>
      <listener-class>org.apache.commons.fileupload.servlet.FileCleanerCleanup</listener-class>
    </listener>

    <!--
        - Declare Spring context listener which sets up the Spring
        Application Context - containing all Cocoon components (and user
        defined beans as well).
    -->
    <listener>
        <listener-class>
            org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

    <!--
        - Declare Spring request listener which sets up the required
        RequestAttributes - to support Springs and Cocoon custom bean
        scopes like the request scope or the - session scope.
    -->
    <listener>
        <listener-class>
            org.springframework.web.context.request.RequestContextListener</listener-class>
    </listener>

    <!--
        Servlet Configuration ==========================================
    -->

    <!--servlet>
        <description>Cocoon</description>
        <display-name>Cocoon</display-name>
        <servlet-name>Cocoon</servlet-name>
        <servlet-class>org.apache.cocoon.servletservice.DispatcherServlet</servlet-class-->
        <!--
            This parameter allows you to startup Cocoon2 immediately after startup
            of your servlet engine.
        -->
        <!--load-on-startup>1</load-on-startup>
    </servlet-->


    <!-- Spring Servlet -->
    <servlet>
        <servlet-name>spring</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <!-- URL space mappings ============================================= -->

    <!--
        Cocoon handles all the URL space assigned to the webapp using its sitemap.
        It is recommended to leave it unchanged. Under some circumstances though
        (like integration with proprietary webapps or servlets) you might have
        to change this parameter.
    -->
    <servlet-mapping>
        <servlet-name>spring</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>

    <!--
        Some servlet engines (Tomcat) have defaults which are not overriden
        by '/' mapping, but must be overriden explicitly.
    -->
    <servlet-mapping>
        <servlet-name>spring</servlet-name>
        <url-pattern>*.jsp</url-pattern>
    </servlet-mapping>
    <!--
        Some servlet engines (WebLogic) have defaults which are not overriden
        by '/' mapping, but must be overriden explicitly.
    -->
    <servlet-mapping>
        <servlet-name>spring</servlet-name>
        <url-pattern>*.html</url-pattern>
    </servlet-mapping>

    <!-- various MIME type mappings ====================================== -->

    <mime-mapping>
        <extension>css</extension>
        <mime-type>text/css</mime-type>
    </mime-mapping>

    <mime-mapping>
        <extension>xml</extension>
        <mime-type>text/xml</mime-type>
    </mime-mapping>

    <mime-mapping>
        <extension>xsl</extension>
        <mime-type>text/xml</mime-type>
    </mime-mapping>

    <mime-mapping>
        <extension>xconf</extension>
        <mime-type>text/xml</mime-type>
    </mime-mapping>

    <mime-mapping>
        <extension>xmap</extension>
        <mime-type>text/xml</mime-type>
    </mime-mapping>

    <mime-mapping>
        <extension>ent</extension>
        <mime-type>text/plain</mime-type>
    </mime-mapping>

    <mime-mapping>
        <extension>grm</extension>
        <mime-type>text/plain</mime-type>
    </mime-mapping>

</web-app>
