<?xml version="1.0" encoding="ISO-8859-1" ?> 

<!--

    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.

-->

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
                 "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
	<display-name>sample-portal</display-name>

	<context-param>
		<param-name>org.exoplatform.frameworks.jcr.command.web.fckeditor.digitalAssetsWorkspace</param-name>
		<param-value>portal</param-value>
		<description>Binary assets workspace name</description>
	</context-param>

	<context-param>
		<param-name>org.exoplatform.frameworks.jcr.command.web.fckeditor.digitalAssetsPath</param-name>
		<param-value>/</param-value>
		<description>Binary assets path</description>
	</context-param>

	<!-- ================================================================== -->
	<!--   RESOURCE FILTER TO CACHE MERGED JAVASCRIPT AND CSS               -->
	<!-- ================================================================== -->
	<filter>
		<filter-name>GenericFilter</filter-name>
		<filter-class>org.exoplatform.web.filter.GenericFilter</filter-class>
	</filter>
	<filter>
		<filter-name>ResourceRequestFilter</filter-name>
		<filter-class>org.exoplatform.portal.application.ResourceRequestFilter</filter-class>
	</filter>

	<filter>
		<filter-name>ThreadLocalSessionProviderInitializedFilter</filter-name>
		<filter-class>org.exoplatform.frameworks.jcr.web.ThreadLocalSessionProviderInitializedFilter</filter-class>
	</filter>

	<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>CacheUserProfileFilter</filter-name>
		<filter-class>org.exoplatform.web.CacheUserProfileFilter</filter-class>
	</filter>
  <filter>
	     <filter-name>PortalContainerFilter</filter-name>
	     <filter-class>org.exoplatform.container.web.PortalContainerFilter</filter-class>
  </filter>  

   <filter-mapping>
	    <filter-name>PortalContainerFilter</filter-name>
	    <url-pattern>/*</url-pattern>
  </filter-mapping>
	<filter-mapping>
		<filter-name>GenericFilter</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>

	<filter-mapping>
		<filter-name>ResourceRequestFilter</filter-name>
		<url-pattern>*.css</url-pattern>
	</filter-mapping>

	<filter-mapping>
		<filter-name>ResourceRequestFilter</filter-name>
		<url-pattern>*.gif</url-pattern>
	</filter-mapping>

	<filter-mapping>
		<filter-name>ResourceRequestFilter</filter-name>
		<url-pattern>*.png</url-pattern>
	</filter-mapping>

	<filter-mapping>
		<filter-name>ResourceRequestFilter</filter-name>
		<url-pattern>*.jpg</url-pattern>
	</filter-mapping>

	<filter-mapping>
		<filter-name>ResourceRequestFilter</filter-name>
		<url-pattern>/javascript/*</url-pattern>
	</filter-mapping>

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

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

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

	<filter-mapping>
		<filter-name>ThreadLocalSessionProviderInitializedFilter</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                                                  -->
	<!-- ================================================================== -->
	<servlet>
		<servlet-name>portal</servlet-name>
		<servlet-class>org.exoplatform.portal.application.PortalController</servlet-class>
		<init-param>
			<param-name>webui.configuration</param-name>
			<param-value>app:/WEB-INF/webui-configuration.xml</param-value>
		</init-param>
		<load-on-startup>1</load-on-startup>
	</servlet>

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

	<servlet>
		<servlet-name>javascript</servlet-name>
		<servlet-class>org.exoplatform.portal.webui.javascript.JavascriptServlet</servlet-class>
	</servlet>

	<servlet>
		<servlet-name>Controller</servlet-name>
		<servlet-class>org.exoplatform.frameworks.jcr.web.CommandControllerServlet</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>

	<servlet>
		<servlet-name>PortalLoginController</servlet-name>
		<servlet-class>org.exoplatform.web.login.PortalLoginController</servlet-class>
	</servlet>
	<servlet>
		<servlet-name>InitiateLoginServlet</servlet-name>
		<servlet-class>org.exoplatform.web.login.InitiateLoginServlet</servlet-class>
	</servlet>
	<servlet>
	    <servlet-name>DoLoginServlet</servlet-name>
	    <servlet-class>org.exoplatform.web.login.DoLoginServlet</servlet-class>
  	</servlet>
	<servlet>
		<servlet-name>ErrorLoginServlet</servlet-name>
		<servlet-class>org.exoplatform.web.login.ErrorLoginServlet</servlet-class>
	</servlet>

	<servlet>
		<servlet-name>GateInServlet</servlet-name>
		<servlet-class>org.gatein.wci.api.GateInServlet</servlet-class>
		<load-on-startup>0</load-on-startup>
	</servlet>
	
	<!--  =================================================================  -->
	<servlet-mapping>
		<servlet-name>InitiateLoginServlet</servlet-name>
		<url-pattern>/initiatelogin</url-pattern>
	</servlet-mapping>
	<servlet-mapping>
		<servlet-name>ErrorLoginServlet</servlet-name>
		<url-pattern>/errorlogin</url-pattern>
	</servlet-mapping>
	<servlet-mapping>
		<servlet-name>PortalLoginController</servlet-name>
		<url-pattern>/login</url-pattern>
	</servlet-mapping>
	<servlet-mapping>
	    <servlet-name>DoLoginServlet</servlet-name>
	    <url-pattern>/dologin</url-pattern>
  	</servlet-mapping>
	<servlet-mapping>
		<servlet-name>javascript</servlet-name>
		<url-pattern>/javascript/*</url-pattern>
	</servlet-mapping>	
	<servlet-mapping>
		<servlet-name>RestServer</servlet-name>
		<url-pattern>/rest/*</url-pattern>
	</servlet-mapping>

	<servlet-mapping>
		<servlet-name>Controller</servlet-name>
		<url-pattern>/connector</url-pattern>
	</servlet-mapping>

	<servlet-mapping>
		<servlet-name>GateInServlet</servlet-name>
		<url-pattern>/gateinservlet</url-pattern>
	</servlet-mapping>

	<servlet-mapping>
	    <servlet-name>portal</servlet-name>
	    <url-pattern>/</url-pattern>
  	</servlet-mapping>

	<!-- Explicit mappings (due to portal servlet on '/') for UIHomePagePortlet, need to find out how to improve that -->
	<servlet-mapping>
	  <servlet-name>default</servlet-name>
	  <url-pattern>*.jpg</url-pattern>
	</servlet-mapping>
	<servlet-mapping>
	  <servlet-name>default</servlet-name>
	  <url-pattern>*.png</url-pattern>
	</servlet-mapping>
	<servlet-mapping>
	  <servlet-name>default</servlet-name>
	  <url-pattern>*.gif</url-pattern>
	</servlet-mapping>
	<servlet-mapping>
	  <servlet-name>default</servlet-name>
	  <url-pattern>*.ico</url-pattern>
	</servlet-mapping>
	<servlet-mapping>
	  <servlet-name>default</servlet-name>
	  <url-pattern>*.css</url-pattern>
	</servlet-mapping>
	
	<security-constraint>
		<web-resource-collection>
			<web-resource-name>user authentication</web-resource-name>
			<url-pattern>/dologin</url-pattern>
			<url-pattern>/private/*</url-pattern>
			<url-pattern>/standalone/*</url-pattern>
			<url-pattern>/g/*</url-pattern>
			<url-pattern>/u/*</url-pattern>
			<http-method>POST</http-method>
			<http-method>GET</http-method>
		</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>
	<security-constraint>
		<web-resource-collection>
			<web-resource-name>admin authentication</web-resource-name>
			<url-pattern>/admin/*</url-pattern>
			<http-method>POST</http-method>
			<http-method>GET</http-method>
		</web-resource-collection>
		<auth-constraint>
			<role-name>admin</role-name>
		</auth-constraint>
		<user-data-constraint>
			<transport-guarantee>NONE</transport-guarantee>
		</user-data-constraint>
	</security-constraint>
	<login-config>
		<auth-method>FORM</auth-method>
		<realm-name>gatein-domain-sample-portal</realm-name>
		<form-login-config>
			<form-login-page>/initiatelogin</form-login-page>
			<form-error-page>/errorlogin</form-error-page>
		</form-login-config>
	</login-config>
	<security-role>
		<description>a simple user role</description>
		<role-name>users</role-name>
	</security-role>
	<security-role>
		<description>the admin role</description>
		<role-name>admin</role-name>
	</security-role>
</web-app>
