<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
      version="3.0">

  <listener>
    <listener-class>org.overlord.sramp.ui.server.fuse61.Listener</listener-class>
  </listener>

  <filter>
    <filter-name>HttpRequestThreadLocalFilter</filter-name>
    <filter-class>org.overlord.commons.auth.jetty8.HttpRequestThreadLocalFilter</filter-class>
  </filter>
  <filter-mapping>
    <filter-name>HttpRequestThreadLocalFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  
  <filter>
    <filter-name>GWTCacheControl</filter-name>
    <filter-class>org.overlord.commons.gwt.server.filters.GWTCacheControlFilter</filter-class>
  </filter>
  <filter-mapping>
    <filter-name>GWTCacheControl</filter-name>
    <url-pattern>/app/*</url-pattern>
  </filter-mapping>

  <filter>
    <filter-name>ResourceCacheControl</filter-name>
    <filter-class>org.overlord.commons.gwt.server.filters.ResourceCacheControlFilter</filter-class>
  </filter>
  <filter-mapping>
    <filter-name>ResourceCacheControl</filter-name>
    <url-pattern>/css/*</url-pattern>
  </filter-mapping>
  <filter-mapping>
    <filter-name>ResourceCacheControl</filter-name>
    <url-pattern>/images/*</url-pattern>
  </filter-mapping>
  <filter-mapping>
    <filter-name>ResourceCacheControl</filter-name>
    <url-pattern>/js/*</url-pattern>
  </filter-mapping>
  
  <filter>
    <filter-name>LocaleFilter</filter-name>
    <filter-class>org.overlord.sramp.ui.server.filters.LocaleFilter</filter-class>
  </filter>
  <filter-mapping>
    <filter-name>LocaleFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>

  <filter>
    <filter-name>OverlordHeaderResources</filter-name>
    <filter-class>org.overlord.commons.ui.header.OverlordHeaderResources</filter-class>
  </filter>
  <filter-mapping>
    <filter-name>OverlordHeaderResources</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>

  <servlet>
    <servlet-name>ErraiServlet</servlet-name>
    <servlet-class>org.jboss.errai.bus.server.servlet.DefaultBlockingServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>ErraiServlet</servlet-name>
    <url-pattern>*.erraiBus</url-pattern>
  </servlet-mapping>
  
  <servlet>
    <servlet-name>OverlordHeaderDataJS</servlet-name>
    <servlet-class>org.overlord.commons.ui.header.OverlordHeaderDataJS</servlet-class>
    <init-param>
        <param-name>app-id</param-name>
        <param-value>s-ramp-ui</param-value>
    </init-param>
  </servlet>
  <servlet-mapping>
    <servlet-name>OverlordHeaderDataJS</servlet-name>
    <url-pattern>/js/overlord-header-data.js</url-pattern>
  </servlet-mapping>
  
  <servlet>
    <servlet-name>ArtifactDownload</servlet-name>
    <servlet-class>org.overlord.sramp.ui.server.servlets.ArtifactDownloadServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>ArtifactDownload</servlet-name>
    <url-pattern>/app/services/artifactDownload</url-pattern>
  </servlet-mapping>
  
  <servlet>
    <servlet-name>ArtifactUpload</servlet-name>
    <servlet-class>org.overlord.sramp.ui.server.servlets.ArtifactUploadServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>ArtifactUpload</servlet-name>
    <url-pattern>/app/services/artifactUpload</url-pattern>
  </servlet-mapping>

  <servlet>
    <servlet-name>OntologyUpload</servlet-name>
    <servlet-class>org.overlord.sramp.ui.server.servlets.OntologyUploadServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>OntologyUpload</servlet-name>
    <url-pattern>/app/services/ontologyUpload</url-pattern>
  </servlet-mapping>

  <resource-env-ref>
    <description>Object factory for the CDI Bean Manager</description>
    <resource-env-ref-name>BeanManager</resource-env-ref-name>
    <resource-env-ref-type>javax.enterprise.inject.spi.BeanManager</resource-env-ref-type>
  </resource-env-ref>

  <context-param>
    <param-name>errai.properties</param-name>
    <param-value>/WEB-INF/errai.properties</param-value>
  </context-param>
  <context-param>
    <param-name>login.config</param-name>
    <param-value>/WEB-INF/login.config</param-value>
  </context-param>
  <context-param>
    <param-name>users.properties</param-name>
    <param-value>/WEB-INF/users.properties</param-value>
  </context-param>

  <security-constraint>
    <web-resource-collection>
      <web-resource-name>S-RAMP</web-resource-name>
      <url-pattern>/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
      <role-name>overlorduser</role-name>
    </auth-constraint>
  </security-constraint>

  <login-config>
    <auth-method>BASIC</auth-method>
    <realm-name>karaf</realm-name>
  </login-config>

  <security-role>
    <role-name>overlorduser</role-name>
  </security-role>

  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
  </welcome-file-list>

</web-app>