<?xml version="1.0" encoding="UTF-8"?>
<web-app 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
    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.springframework.web.context.ContextLoaderListener</listener-class>  
  </listener>
  <listener>  
      <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>  
  </listener>
  <context-param>  
    <param-name>contextConfigLocation</param-name>  
    <param-value>/WEB-INF/applicationContext.xml</param-value>  
  </context-param>
  <servlet>
    <servlet-name>cometd</servlet-name>
    <servlet-class>org.cometd.server.CometdServlet</servlet-class>
    <init-param>
      <param-name>logLevel</param-name>
      <param-value>1</param-value>
    </init-param>
    <init-param>
      <param-name>timeout</param-name>
      <param-value>30000</param-value>
    </init-param>
    <init-param>
      <param-name>jsonDebug</param-name>
      <param-value>false</param-value>
    </init-param>    
    <init-param>
      <param-name>maxSessionsPerBrowser</param-name>
      <param-value>-1</param-value>
    </init-param>
    <init-param>
      <param-name>transports</param-name>
      <param-value>org.cometd.websocket.server.WebSocketTransport</param-value>
    </init-param>
    <init-param>
       <param-name>ws.bufferSize</param-name>
       <param-value>100000</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>cometd</servlet-name>
    <url-pattern>/cometd/*</url-pattern>
  </servlet-mapping>
  <servlet>
    <servlet-name>admin</servlet-name>
    <servlet-class>org.coweb.servlet.AdminServlet</servlet-class>
    <init-param>
      <param-name>ConfigURI</param-name>
      <param-value>/WEB-INF/cowebConfig.json</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>admin</servlet-name>
    <url-pattern>/ocw_admin/*</url-pattern>
  </servlet-mapping>
  <servlet>
    <servlet-name>restServlet</servlet-name>
    <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
    <init-param>
      <param-name>javax.ws.rs.Application</param-name>
      <param-value>org.iri_research.renkan.rest.RestApplication</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>restServlet</servlet-name>
    <url-pattern>/rest/*</url-pattern>
  </servlet-mapping>
  <servlet>
    <servlet-name>spring</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>spring</servlet-name>
    <url-pattern>/</url-pattern>
  </servlet-mapping>
  <filter>
      <filter-name>springSecurityFilterChain</filter-name>
      <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
  </filter>
  <filter-mapping>
      <filter-name>springSecurityFilterChain</filter-name>
      <url-pattern>/*</url-pattern>
  </filter-mapping>
  <filter>
    <filter-name>cross-origin</filter-name>
    <filter-class>org.eclipse.jetty.servlets.CrossOriginFilter</filter-class>
  </filter>
  <filter-mapping>
    <filter-name>cross-origin</filter-name>
    <url-pattern>/cometd/*</url-pattern>
    <url-pattern>/rest/*</url-pattern>
  </filter-mapping>
</web-app>
