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

    Aipo is a groupware program developed by Aimluck,Inc.
    Copyright (C) 2004-2011 Aimluck,Inc.
    http://www.aipo.com

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as
    published by the Free Software Foundation, either version 3 of the
    License, or (at your option) any later version.

    This program 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 Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

-->

<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_2_5.xsd"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
	version="2.5">
	<display-name>Aipo OpenSocial Container</display-name>
	<!-- configuration -->
	<!-- If you have your own Guice module(s), put them here as a colon-separated 
		list. -->
	<!-- Note that any extras modules are optional -->
	<context-param>
		<param-name>guice-modules</param-name>
		<param-value>
      org.apache.shindig.common.PropertiesModule:
      com.aipo.orm.AipoOrmModule:
      com.aipo.container.AipoContainerModule:
      com.aipo.container.cache.AipoCacheModule:
      com.aipo.container.gadgets.AipoGadgetsGuiceModule:
      com.aipo.container.gadgets.oauth.AipoOAuthModule:
      com.aipo.social.core.config.AipoSocialApiGuiceModule:
      com.aipo.social.opensocial.spi.AipoSocialModule
    </param-value>
	</context-param>

	<!-- Syntax: <key>=<value> separated by a newline system.properties specifies 
		the environmental variables that will be set to the JVM System Properties 
		at server startup time. Alternatively, you may add these values in your app 
		server (ex: Tomcat) as VM arguments like this: -Dshindig.host="my.production.shindig.server.com". 
		Here are a few properties that can be set for Shindig: shindig.host: the 
		server name that Shindig is deployed and running on shindig.port: the port 
		number of shindig.host server Make sure you escape all HTML values for the 
		web.xml to be parsed correctly. -->
	<context-param>
		<param-name>system.properties</param-name>
		<param-value>
    	shindig.host=localhost
    	
    	aKey=/shindig/gadgets/proxy?container=default&amp;url=
    	shindig.port=
    	
     </param-value>
	</context-param>

	<filter>
		<filter-name>containerFilter</filter-name>
		<filter-class>com.aipo.container.http.ContainerFilter</filter-class>
	</filter>

	<filter>
		<filter-name>databaseFilter</filter-name>
		<filter-class>com.aipo.orm.filter.DatabaseFilter</filter-class>
	</filter>

	<!-- filter>
		<filter-name>ShiroFilter</filter-name>
		<filter-class>org.apache.shiro.web.servlet.IniShiroFilter</filter-class>
		<init-param>
			<param-name>config</param-name>
			<param-value>
                # The ShiroFilter configuration is very powerful and flexible, while still remaining succinct.
                # Please read the comprehensive example, with full comments and explanations, in the JavaDoc:
                #
                # http://www.jsecurity.org/api/org/jsecurity/web/servlet/JSecurityFilter.html
                [main]
                shindigSampleRealm = org.apache.shindig.sample.shiro.SampleShiroRealm
                securityManager.realm = $shindigSampleRealm
                authc.loginUrl = /login.jsp

                [urls]
                # The /login.jsp is not restricted to authenticated users (otherwise no one could log in!), but
                # the 'authc' filter must still be specified for it so it can process that url's
                # login submissions. It is 'smart' enough to allow those requests through as specified by the
                # shiro.loginUrl above.
                /login.jsp = authc

                /oauth/authorize/** = authc

            </param-value>
		</init-param>
	</filter -->

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

	<filter>
		<filter-name>authFilter</filter-name>
		<filter-class>org.apache.shindig.auth.AuthenticationServletFilter</filter-class>
	</filter>

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

	<!-- filter-mapping>
		<filter-name>ShiroFilter</filter-name>
		<url-pattern>/oauth/authorize</url-pattern>
	</filter-mapping -->

	<!-- filter-mapping>
		<filter-name>ShiroFilter</filter-name>
		<url-pattern>*.jsp</url-pattern>
	</filter-mapping -->

	<filter-mapping>
		<filter-name>authFilter</filter-name>
		<url-pattern>/social/*</url-pattern>
		<url-pattern>/gadgets/ifr</url-pattern>
		<url-pattern>/gadgets/makeRequest</url-pattern>
		<url-pattern>/gadgets/api/rpc/*</url-pattern>
		<url-pattern>/gadgets/api/rest/*</url-pattern>
		<url-pattern>/rpc/*</url-pattern>
		<url-pattern>/rest/*</url-pattern>
	</filter-mapping>

	<listener>
		<listener-class>org.apache.shindig.common.servlet.GuiceServletContextListener</listener-class>
	</listener>

	<!-- Render a Gadget -->
	<servlet>
		<servlet-name>xml-to-html</servlet-name>
		<servlet-class>
			org.apache.shindig.gadgets.servlet.GadgetRenderingServlet</servlet-class>
	</servlet>

	<!-- servlet>
		<servlet-name>accel</servlet-name>
		<servlet-class>org.apache.shindig.gadgets.servlet.HtmlAccelServlet</servlet-class>
	</servlet -->

	<!-- Proxy -->
	<!-- servlet> <servlet-name>proxy</servlet-name> <servlet-class> org.apache.shindig.gadgets.servlet.ProxyServlet 
		</servlet-class> </servlet -->

	<!-- makeRequest -->
	<servlet>
		<servlet-name>makeRequest</servlet-name>
		<servlet-class>org.apache.shindig.gadgets.servlet.MakeRequestServlet</servlet-class>
	</servlet>

	<!-- Concat -->
	<!-- servlet> <servlet-name>concat</servlet-name> <servlet-class> org.apache.shindig.gadgets.servlet.ConcatProxyServlet 
		</servlet-class> </servlet -->

	<!-- OAuth callback -->
	<servlet>
		<servlet-name>oauthCallback</servlet-name>
		<servlet-class>
			org.apache.shindig.gadgets.servlet.OAuthCallbackServlet</servlet-class>
	</servlet>

	<!-- Metadata RPC -->
	<servlet>
		<servlet-name>metadata</servlet-name>
		<servlet-class>org.apache.shindig.gadgets.servlet.RpcServlet</servlet-class>
	</servlet>

	<!-- javascript serving -->
	<servlet>
		<servlet-name>js</servlet-name>
		<servlet-class>org.apache.shindig.gadgets.servlet.JsServlet</servlet-class>
	</servlet>

	<!-- servlet>
		<servlet-name>restapiServlet</servlet-name>
		<servlet-class>org.apache.shindig.protocol.DataServiceServlet</servlet-class>
		<init-param>
			<param-name>handlers</param-name>
			<param-value>org.apache.shindig.handlers</param-value>
		</init-param>
	</servlet -->

	<!-- Serve social RPC api -->
	<servlet>
		<servlet-name>jsonRpcServlet</servlet-name>
		<servlet-class>org.apache.shindig.protocol.JsonRpcServlet</servlet-class>
		<init-param>
			<param-name>handlers</param-name>
			<param-value>org.apache.shindig.handlers</param-value>
		</init-param>
	</servlet>

	<!-- Serve sample OAuth apis -->
	<!-- servlet>
		<servlet-name>sampleOAuth</servlet-name>
		<servlet-class>
			org.apache.shindig.social.sample.oauth.SampleOAuthServlet</servlet-class>
	</servlet -->

	<servlet-mapping>
		<servlet-name>js</servlet-name>
		<url-pattern>/gadgets/js/*</url-pattern>
	</servlet-mapping>

	<!-- servlet-mapping> <servlet-name>proxy</servlet-name> <url-pattern>/gadgets/proxy/*</url-pattern> 
		</servlet-mapping -->

	<servlet-mapping>
		<servlet-name>makeRequest</servlet-name>
		<url-pattern>/gadgets/makeRequest</url-pattern>
	</servlet-mapping>

	<servlet-mapping>
		<servlet-name>jsonRpcServlet</servlet-name>
		<url-pattern>/rpc/*</url-pattern>
		<url-pattern>/gadgets/api/rpc/*</url-pattern>
		<url-pattern>/social/rpc/*</url-pattern>
	</servlet-mapping>

	<!-- servlet-mapping>
		<servlet-name>restapiServlet</servlet-name>
		<url-pattern>/rest/*</url-pattern>
		<url-pattern>/gadgets/api/rest/*</url-pattern>
		<url-pattern>/social/rest/*</url-pattern>
	</servlet-mapping -->

	<!-- servlet-mapping> <servlet-name>concat</servlet-name> <url-pattern>/gadgets/concat</url-pattern> 
		</servlet-mapping -->

	<servlet-mapping>
		<servlet-name>oauthCallback</servlet-name>
		<url-pattern>/gadgets/oauthcallback</url-pattern>
	</servlet-mapping>

	<servlet-mapping>
		<servlet-name>xml-to-html</servlet-name>
		<url-pattern>/gadgets/ifr</url-pattern>
	</servlet-mapping>

	<!-- servlet-mapping>
		<servlet-name>accel</servlet-name>
		<url-pattern>/gadgets/accel</url-pattern>
	</servlet-mapping -->

	<servlet-mapping>
		<servlet-name>metadata</servlet-name>
		<url-pattern>/gadgets/metadata</url-pattern>
	</servlet-mapping>

	<!-- servlet-mapping>
		<servlet-name>sampleOAuth</servlet-name>
		<url-pattern>/oauth/*</url-pattern>
	</servlet-mapping -->

</web-app>
