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

    Copyright (C) 2009 eXo Platform SAS.
    
    This is free software; you can redistribute it and/or modify it
    under the terms of the GNU Lesser General Public License as
    published by the Free Software Foundation; either version 2.1 of
    the License, or (at your option) any later version.
    
    This software is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    Lesser General Public License for more details.
    
    You should have received a copy of the GNU Lesser General Public
    License along with this software; if not, write to the Free
    Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
    02110-1301 USA, or see the FSF site: http://www.fsf.org.

-->

<web-app version="3.0" metadata-complete="true"
	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">

  <display-name>rest</display-name>

  <filter>
    <filter-name>SetCurrentIdentityFilter</filter-name>
    <filter-class>org.exoplatform.services.security.web.SetCurrentIdentityFilter</filter-class>
    <init-param>
      <param-name>restoreIdentity</param-name>
      <param-value>true</param-value>
    </init-param>
  </filter>
  <filter>
    <filter-name>RestEncodingFilter</filter-name>
    <filter-class>org.exoplatform.services.rest.servlet.RestEncodingFilter</filter-class>
    <init-param>
      <param-name>REQUEST_ENCODING</param-name>
      <param-value>UTF-8</param-value>
    </init-param>
  </filter>
  <filter>
    <filter-name>PortalCheckInitFilter</filter-name>
    <filter-class>org.gatein.portal.init.PortalCheckInitFilter</filter-class>
  </filter>
  <filter>
    <filter-name>LocalizationFilter</filter-name>
    <filter-class>org.exoplatform.portal.application.localization.LocalizationFilter</filter-class>
  </filter>
  <filter-mapping>
    <filter-name>PortalCheckInitFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  <filter-mapping>
    <filter-name>LocalizationFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  <filter-mapping>
    <filter-name>SetCurrentIdentityFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>

  <filter-mapping>
    <filter-name>RestEncodingFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>

  <!-- ================================================================== -->
  <!--           LISTENER                                                 -->
  <!-- ================================================================== -->
  <listener>
    <listener-class>org.exoplatform.web.GenericHttpListener</listener-class>
  </listener>
  <listener>
    <listener-class>org.exoplatform.services.security.web.JAASConversationStateListener</listener-class>
  </listener>

  <servlet>
    <description>eXo - Platform REST Server</description>
    <servlet-name>RestServer</servlet-name>
    <servlet-class>org.exoplatform.services.rest.servlet.RestServlet</servlet-class>
    <load-on-startup>4</load-on-startup>
  </servlet>

  <servlet-mapping>
    <servlet-name>RestServer</servlet-name>
    <url-pattern>/private/*</url-pattern>
  </servlet-mapping>

  <servlet-mapping>
    <servlet-name>RestServer</servlet-name>
    <url-pattern>/*</url-pattern>
  </servlet-mapping>

  <security-constraint>
    <web-resource-collection>
      <web-resource-name>rest</web-resource-name>
      <url-pattern>/private/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
      <role-name>users</role-name>
    </auth-constraint>
    <user-data-constraint>
      <transport-guarantee>NONE</transport-guarantee>
    </user-data-constraint>
  </security-constraint>

  <login-config>
    <auth-method>BASIC</auth-method>
    <realm-name>gatein-domain</realm-name>
  </login-config>

  <security-role>
    <description>the user role</description>
    <role-name>users</role-name>
  </security-role>

  <absolute-ordering/>

</web-app>

