<?xml version="1.0" encoding="UTF-8"?>
<web-app 
   xmlns="http://xmlns.jcp.org/xml/ns/javaee" 
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
   metadata-complete="false"
   version="3.1"> 

  <display-name>Test WebApp</display-name>
  
  <context-param>
    <param-name>org.eclipse.jetty.server.context.ManagedAttributes</param-name>
    <param-value>PushFilter,QoSFilter,TransparentProxy.ThreadPool,TransparentProxy.HttpClient</param-value>
  </context-param>
  
  <!-- Declare TestListener, which declares TestFilter -->
  <listener>
    <listener-class>com.acme.TestListener</listener-class>
  </listener>

  <filter>
    <filter-name>PushFilter</filter-name>
    <filter-class>org.eclipse.jetty.servlets.PushCacheFilter</filter-class>
    <async-supported>true</async-supported>
  </filter>  
  <filter-mapping>
    <filter-name>PushFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>

  <filter>
    <filter-name>QoSFilter</filter-name>
    <filter-class>org.eclipse.jetty.servlets.QoSFilter</filter-class>
    <async-supported>true</async-supported>
    <init-param>
      <param-name>maxRequests</param-name>
      <param-value>10000</param-value>
    </init-param>
    <init-param>
      <param-name>managedAttr</param-name>
      <param-value>true</param-value>
    </init-param>
  </filter>  
  <filter-mapping>
    <filter-name>QoSFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>

  <servlet>
    <servlet-name>Login</servlet-name>
    <servlet-class>com.acme.LoginServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>

  <servlet-mapping>
    <servlet-name>Login</servlet-name>
    <url-pattern>/login/*</url-pattern>
  </servlet-mapping>


  <servlet>
    <servlet-name>Hello</servlet-name>
    <servlet-class>com.acme.HelloWorld</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>

  <servlet-mapping>
    <servlet-name>Hello</servlet-name>
    <url-pattern>/hello/*</url-pattern>
  </servlet-mapping>
  
  <servlet>
    <servlet-name>Dump</servlet-name>
    <servlet-class>com.acme.Dump</servlet-class>
    <load-on-startup>1</load-on-startup>
    <async-supported>true</async-supported>
    <run-as><role-name>admin</role-name></run-as>
    <multipart-config>
      <location>upload</location>
      <file-size-threshold>4096</file-size-threshold>
    </multipart-config>
  </servlet>

  <servlet-mapping>
    <servlet-name>Dump</servlet-name>
    <url-pattern>/dump/*</url-pattern>
    <url-pattern>*.dump</url-pattern>
  </servlet-mapping>

  <servlet>
    <servlet-name>Session</servlet-name>
    <servlet-class>com.acme.SessionDump</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  
  <servlet-mapping>
    <servlet-name>Session</servlet-name>
    <url-pattern>/session/*</url-pattern>
  </servlet-mapping>
  
  <servlet>
    <servlet-name>Cookie</servlet-name>
    <servlet-class>com.acme.CookieDump</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  
  <servlet-mapping>
    <servlet-name>Cookie</servlet-name>
    <url-pattern>/cookie/*</url-pattern>
  </servlet-mapping>
  
  <servlet>
    <servlet-name>Dispatch</servlet-name>
    <servlet-class>com.acme.DispatchServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    <async-supported>true</async-supported>
  </servlet>
  
  <servlet-mapping>
    <servlet-name>Dispatch</servlet-name>
    <url-pattern>/dispatch/*</url-pattern>
  </servlet-mapping>
  
  <servlet>
    <servlet-name>CGI</servlet-name>
    <servlet-class>org.eclipse.jetty.servlets.CGI</servlet-class>
    <load-on-startup>1</load-on-startup>
    <async-supported>true</async-supported>
  </servlet>
  
  <servlet-mapping>
    <servlet-name>CGI</servlet-name>
    <url-pattern>/cgi-bin/*</url-pattern>
  </servlet-mapping>
  
  <servlet>
    <servlet-name>Chat</servlet-name>
    <servlet-class>com.acme.ChatServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    <async-supported>true</async-supported>
  </servlet>

  <servlet-mapping>
    <servlet-name>Chat</servlet-name>
    <url-pattern>/chat/*</url-pattern>
  </servlet-mapping>
  
  <servlet>
    <servlet-name>WSChat</servlet-name>
    <servlet-class>com.acme.WebSocketChatServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>

  <servlet-mapping>
    <servlet-name>WSChat</servlet-name>
    <url-pattern>/ws/*</url-pattern>
  </servlet-mapping>
  
  
  <servlet>
    <servlet-name>Rewrite</servlet-name>
    <servlet-class>com.acme.RewriteServlet</servlet-class>
  </servlet>
  
  <servlet-mapping>
    <servlet-name>Rewrite</servlet-name>
    <url-pattern>/rewritten/*</url-pattern>
    <url-pattern>/redirected/*</url-pattern>
  </servlet-mapping>
  
  
  <servlet>
    <servlet-name>SecureMode</servlet-name>
    <servlet-class>com.acme.SecureModeServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>

  <servlet-mapping>
    <servlet-name>SecureMode</servlet-name>
    <url-pattern>/secureMode/*</url-pattern>
  </servlet-mapping>
  
  <servlet>
     <servlet-name>foo.jsp</servlet-name>
     <jsp-file>/jsp/foo/foo.jsp</jsp-file>
  </servlet>
  <servlet-mapping>
    <servlet-name>foo.jsp</servlet-name>
    <url-pattern>/jsp/foo/</url-pattern>
  </servlet-mapping>


  <servlet>
    <servlet-name>TestServlet</servlet-name>
    <servlet-class>com.acme.TestServlet</servlet-class>
    <load-on-startup>10</load-on-startup>
  </servlet>

  <servlet-mapping>
    <servlet-name>TestServlet</servlet-name>
    <url-pattern>/testservlet/*</url-pattern>
  </servlet-mapping>

  <error-page>
    <error-code>404</error-code>
    <location>/error404.html</location>
  </error-page>

  <security-constraint>
    <web-resource-collection>
      <web-resource-name>Rego2</web-resource-name>
      <url-pattern>/rego2/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
      <role-name>server-administrator</role-name>
    </auth-constraint>
  </security-constraint>

  <security-constraint>
    <web-resource-collection>
      <web-resource-name>Auth2</web-resource-name>
      <url-pattern>/auth2/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
      <role-name>*</role-name>
    </auth-constraint>
  </security-constraint>

  <security-constraint>
    <web-resource-collection>
      <web-resource-name>Any User</web-resource-name>
      <url-pattern>/dump/auth/*</url-pattern>
      <url-pattern>*.htm</url-pattern>
    </web-resource-collection>
    <auth-constraint>
      <role-name>*</role-name>
    </auth-constraint>
  </security-constraint>

  <security-constraint>
    <web-resource-collection>
      <web-resource-name>relax</web-resource-name>
      <url-pattern>/dump/auth/relax/*</url-pattern>
      <url-pattern>/auth/relax.txt</url-pattern>
    </web-resource-collection>
  </security-constraint>

  <security-constraint>
    <web-resource-collection>
      <web-resource-name>Admin Role</web-resource-name>
      <url-pattern>/dump/auth/admin/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
      <role-name>admin</role-name>
    </auth-constraint>
  </security-constraint>

  <security-constraint>
    <web-resource-collection>
      <web-resource-name>Forbidden</web-resource-name>
      <url-pattern>/dump/auth/noaccess/*</url-pattern>
      <url-pattern>/auth/*</url-pattern>
    </web-resource-collection>
    <auth-constraint/>
  </security-constraint>

  <security-constraint>
    <web-resource-collection>
      <web-resource-name>SSL</web-resource-name>
      <url-pattern>/dump/auth/ssl/*</url-pattern>
    </web-resource-collection>
    <user-data-constraint>
      <transport-guarantee>CONFIDENTIAL</transport-guarantee>
    </user-data-constraint>
  </security-constraint>

<!--
  <login-config>
    <auth-method>BASIC</auth-method>
    <realm-name>Test Realm</realm-name>
  </login-config>
-->

<!--
  <login-config>
    <auth-method>DIGEST</auth-method>
    <realm-name>Test Realm</realm-name>
  </login-config>
-->

  <login-config>
    <auth-method>FORM</auth-method>
    <realm-name>Test Realm</realm-name>
    <form-login-config>
       <form-login-page>/logon.html?param=test</form-login-page>
       <form-error-page>/logonError.html?param=test</form-error-page>
    </form-login-config>
  </login-config>
  
  <session-config>
    <session-timeout>5</session-timeout>
  </session-config>

  <security-role>
    <role-name>admin</role-name>
  </security-role>
  <security-role>
    <role-name>user</role-name>
  </security-role>

</web-app>


