<web-app xmlns="http://caucho.com/ns/resin"
         xmlns:resin="http://caucho.com/ns/resin/core">

  <class-loader>
    <simple-loader path="WEB-INF/xsl"/>
    <compiling-loader path="WEB-INF/classes" source="WEB-INF/src"/>
  </class-loader>

  <database jndi-name="jdbc/resin">
    <driver type="com.caucho.db.jdbc.ConnectionPoolDataSourceImpl">
      <path>WEB-INF/db</path>
      <remove-on-error/>
    </driver>
  </database>

  <resin:set var="doc_context_path" value="${webApp.contextPath}"/>

    <servlet servlet-name="viewfile" 
             servlet-class="com.caucho.doc.ViewFileServlet">
    </servlet>
    <servlet-mapping url-pattern="/viewfile/*" servlet-name="viewfile"/>
  
    <system-property javax.xml.stream.XMLOutputFactory="com.caucho.xml.stream.XMLOutputFactoryImpl"/>

    <servlet servlet-name="xtp-doc" 
             servlet-class="com.caucho.xtpdoc.ResinDocServlet"/>
    <servlet-mapping url-pattern="*.xtp" servlet-name="xtp-doc"/>
		   
    <welcome-file-list>
      <welcome-file>index.xtp</welcome-file>
      <welcome-file>index.jsp</welcome-file>
      <welcome-file>index.php</welcome-file>
      <welcome-file>index.html</welcome-file>
    </welcome-file-list>
    
    <web-app-default>
      <servlet servlet-name="viewfile" 
               servlet-class="com.caucho.doc.ViewFileServlet"/>
      <servlet-mapping url-pattern="/viewfile/*" servlet-name="viewfile"/>
      <inherit-session>true</inherit-session>

      <servlet servlet-name="xtp-doc" 
               servlet-class="com.caucho.xtpdoc.ResinDocServlet">
        <init doc-context-path="${doc_context_path}"/>
      </servlet>
      <servlet-mapping url-pattern="*.xtp" servlet-name="xtp-doc"/>
		   
      <welcome-file-list>
        <welcome-file>index.xtp</welcome-file>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>index.php</welcome-file>
        <welcome-file>index.html</welcome-file>
      </welcome-file-list>
    </web-app-default>

  <rewrite-dispatch>
    <redirect regexp="/php" target="${app.contextPath}/quercus"/>

    <redirect regexp="/soa/tutorial/soa-flickr"
              target="${app.contextPath}/tutorial/rest-flickr"/>
    <redirect regexp="/.*/tutorial" target="${app.contextPath}/tutorial"/>
    
    <redirect regexp="/quercus/.*" target="${app.contextPath}/doc/quercus.xtp"/>

    <redirect regexp="/doc/quercus-java-interface.xtp" target="${app.contextPath}/doc/quercus-java-integration.xtp"/>
    <redirect regexp="/doc/quercus-getting-started.xtp" target="${app.contextPath}/doc/quercus-overview.xtp"/>
  </rewrite-dispatch>

  <resin:if test="${not caucho_site}">
  <web-app-deploy url-prefix="/examples"
                  path="examples"
                  startup-mode="lazy">
  </web-app-deploy>
  </resin:if>

  <servlet servlet-name="javadoc" 
           servlet-class="com.caucho.doc.JavadocRedirectServlet"/>

  <servlet-mapping url-pattern="/javadoc/*" servlet-name="javadoc"/>
</web-app>

