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

<!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>xwiki</display-name>
  <description>XWiki Application</description>

  <filter>
    <filter-name>Set Character Encoding</filter-name>
    <filter-class>com.xpn.xwiki.web.SetCharacterEncodingFilter</filter-class>
    <init-param>
      <param-name>encoding</param-name>
      <param-value>ISO-8859-1</param-value>
    </init-param>
  </filter>

  <filter-mapping>
    <filter-name>Set Character Encoding</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>

  <!-- Initializes Plexus and puts a reference to the Plexus Component Manager in the Servlet
    Context. Also initializes the Container Manager component with the Servlet Context. -->
  <listener>
    <listener-class>org.xwiki.plexus.XWikiPlexusServletContextListener</listener-class>
  </listener>

  <!-- Main Plexus Servlet receiving all requests. For now this is mapped to some unused URL
    contex path since we're still using Struts but in the near future, Struts will go away
    and be replaced by XWiki's own Action component. -->
  <servlet>
    <servlet-name>PlexusServlet</servlet-name>
    <servlet-class>org.xwiki.plexus.XWikiPlexusServlet</servlet-class>
  </servlet>

  <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
      <param-name>application</param-name>
      <param-value>ApplicationResources</param-value>
    </init-param>
    <init-param>
      <param-name>xwiki</param-name>
      <param-value>com.xpn.xwiki.XWiki</param-value>
    </init-param>
    <init-param>
      <param-name>config</param-name>
      <param-value>/WEB-INF/struts-config.xml</param-value>
    </init-param>
    <init-param>
      <param-name>debug</param-name>
      <param-value>2</param-value>
    </init-param>
    <init-param>
      <param-name>detail</param-name>
      <param-value>2</param-value>
    </init-param>
    <init-param>
      <param-name>validate</param-name>
      <param-value>true</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
  </servlet>

  <servlet>
    <servlet-name>redirectHomeServlet</servlet-name>
    <servlet-class>com.xpn.xwiki.web.HomePageRedirectServlet</servlet-class>
  </servlet>

  <servlet>
    <servlet-name>xmlrpc</servlet-name>
    <servlet-class>com.xpn.xwiki.xmlrpc.XWikiXmlRpcServlet</servlet-class>
    <init-param>
      <param-name>enabledForExtensions</param-name>
      <param-value>false</param-value>
      <description>Sets, whether the servlet supports vendor extensions for XML-RPC.</description>
    </init-param>
  </servlet>

  <!-- This is the entry pointy for XWiki GWT services -->
  <servlet>
    <servlet-name>XWikiService</servlet-name>
    <servlet-class>com.xpn.xwiki.gwt.api.server.XWikiServiceImpl</servlet-class>
  </servlet>

  <!-- This is the entry pointy for Wysiwyg GWT services -->
  <servlet>
    <servlet-name>WysiwygService</servlet-name>
    <servlet-class>com.xpn.xwiki.wysiwyg.server.WysiwygServiceImpl</servlet-class>
  </servlet>

  <!-- Unused mapping for now. In the future the correct mapping will be /* when the action servlet
    will be decommissioned in favor of the XWiki Action component -->
  <servlet-mapping>
    <servlet-name>PlexusServlet</servlet-name>
    <url-pattern>/plexus/*</url-pattern>
  </servlet-mapping>

  <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>/bin/*</url-pattern>
  </servlet-mapping>

  <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>/testbin/*</url-pattern>
  </servlet-mapping>

  <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>/xwiki/*</url-pattern>
  </servlet-mapping>

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

  <servlet-mapping>
    <servlet-name>redirectHomeServlet</servlet-name>
    <url-pattern>/redirect</url-pattern>
  </servlet-mapping>

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

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

  <!-- We override the mime type definition for javascript and css files, as some containers don't
    provide it, causing problems for javascript files containg velocity code, like
    fullscreenEdit.js -->
  <mime-mapping>
    <extension>js</extension>
    <mime-type>text/javascript</mime-type>
  </mime-mapping>

  <mime-mapping>
    <extension>css</extension>
    <mime-type>text/css</mime-type>
  </mime-mapping>

  <!-- Redirects to the Main.WebHome page if the user calls the root of the webapp, i.e.
    http://server:port/xwiki/
    Note 1: for this to work fine the redirect file needs to exist in the WAR
    Note 2: with Servlet 2.4 it's possible to have a Servlet directly specified in the welcome
    file list but right now we'd like XWiki to work out of the box with Servlet 2.3
  -->
  <welcome-file-list>
    <welcome-file>redirect</welcome-file>
  </welcome-file-list>

  <error-page>
    <error-code>404</error-code>
    <location>/bin/view/Main/DocumentDoesNotExist</location>
  </error-page>

  <!-- Struts Tag Library Descriptors -->
  <taglib>
    <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
  </taglib>

  <taglib>
    <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
  </taglib>

  <taglib>
    <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
  </taglib>

  <!-- Uncomment if you wish to use a DataSource to define the Database connection
    <resource-ref>
    <description>DB Connection</description>
    <res-ref-name>jdbc/XWikiDS</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
  -->

  <env-entry>
    <env-entry-name>XWikiConfig</env-entry-name>
    <env-entry-value>/WEB-INF/xwiki.cfg</env-entry-value>
    <env-entry-type>java.lang.String</env-entry-type>
  </env-entry>
</web-app>
