<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

    <display-name>Ubiquiti Networks: Management Console</display-name>

    <!-- Device Management Servlets -->
    <servlet>
        <servlet-name>InformServlet</servlet-name>
        <servlet-class>com.ubnt.net.InformServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>InformServlet</servlet-name>
        <url-pattern>/inform</url-pattern>
    </servlet-mapping>

    <!-- API Servlets -->
    <servlet>
        <servlet-name>ApiServlet</servlet-name>
        <servlet-class>com.ubnt.ace.api.ApiServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>ApiServlet</servlet-name>
        <url-pattern>/api/*</url-pattern>
    </servlet-mapping>

    <!-- Download Servlet -->
    <servlet>
        <servlet-name>DownloadServlet</servlet-name>
        <servlet-class>com.ubnt.ace.view.DownloadServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>DownloadServlet</servlet-name>
        <url-pattern>/dl/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>DownloadServlet</servlet-name>
        <url-pattern>/file/*</url-pattern>
    </servlet-mapping>

    <!-- Upload Servlet -->
    <servlet>
        <servlet-name>UploadServlet</servlet-name>
        <servlet-class>com.ubnt.ace.view.UploadServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>UploadServlet</servlet-name>
        <url-pattern>/upload/*</url-pattern>
    </servlet-mapping>

    <!-- handles print requests -->
    <servlet>
        <servlet-name>PrintServlet</servlet-name>
        <servlet-class>com.ubnt.ace.view.PrintServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>PrintServlet</servlet-name>
        <url-pattern>/print/*</url-pattern>
    </servlet-mapping>

    <!-- handles CLI requests -->
    <servlet>
        <servlet-name>CliServlet</servlet-name>
        <servlet-class>com.ubnt.ace.view.CliServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>CliServlet</servlet-name>
        <url-pattern>/cli/*</url-pattern>
    </servlet-mapping>

    <!-- handles the guest portal -->
    <servlet>
        <servlet-name>GuestServlet</servlet-name>
        <servlet-class>com.ubnt.ace.view.GuestServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>GuestServlet</servlet-name>
        <url-pattern>/guest/*</url-pattern>
    </servlet-mapping>

    <servlet>
        <servlet-name>UpnpServlet</servlet-name>
        <servlet-class>com.ubnt.ace.view.UpnpServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>UpnpServlet</servlet-name>
        <url-pattern>/upnp</url-pattern>
    </servlet-mapping>

    <!--
        status servlet is used by the Launcher to query the current
        status of the server during starting up
    -->
    <servlet>
        <servlet-name>ServiceServlet</servlet-name>
        <servlet-class>com.ubnt.ace.view.ServiceServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>ServiceServlet</servlet-name>
        <url-pattern>/status</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>ServiceServlet</servlet-name>
        <url-pattern>/ident</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>ServiceServlet</servlet-name>
        <url-pattern>/services/*</url-pattern>
    </servlet-mapping>

    <!--  UI Servlets -->

    <!--
        <servlet>
        <servlet-name>shell</servlet-name>
        <jsp-file>/shell.html</jsp-file>
        </servlet>
    -->

    <!--
        <servlet-mapping>
        <servlet-name>shell</servlet-name>
        <url-pattern>/shell</url-pattern>
        </servlet-mapping>
    -->

    <filter>
        <filter-name>AuthFilter</filter-name>
        <filter-class>com.ubnt.ace.view.AuthFilter</filter-class>
        <!--
            <init-param>
            <param-name>skip</param-name>
            <param-value>false</param-value>
            </init-param>
        -->
    </filter>

    <filter>
        <filter-name>UrlRewriteFilter</filter-name>
        <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
        <init-param>
            <param-name>logLevel</param-name>
            <param-value>WARN</param-value>
        </init-param>
    </filter>

    <filter>
        <filter-name>ResourceFilter</filter-name>
        <filter-class>com.ubnt.ace.view.ResourceFilter</filter-class>
    </filter>

    <!--filter>
        <filter-name>ClickjackFilterDeny</filter-name>
        <filter-class>com.ubnt.ace.view.ClickjackFilter</filter-class>
        <init-param>
            <param-name>mode</param-name>
            <param-value>DENY</param-value>
        </init-param>
    </filter> -->

    <filter>
        <filter-name>ClickjackFilterSameOrigin</filter-name>
        <filter-class>com.ubnt.ace.view.ClickjackFilter</filter-class>
        <init-param>
            <param-name>mode</param-name>
            <param-value>SAMEORIGIN</param-value>
        </init-param>
    </filter>

    <!--
        AuthFilter handles all the requests to the Admin interface ONLY
    -->
    <filter-mapping>
        <filter-name>AuthFilter</filter-name>
        <url-pattern>/</url-pattern>
        <url-pattern>/login/*</url-pattern>
        <url-pattern>/logout/*</url-pattern>
        <url-pattern>/manage/*</url-pattern>
        <url-pattern>/wizard/*</url-pattern>
        <url-pattern>/hotspot/*</url-pattern>
        <url-pattern>/super/*</url-pattern>
        <url-pattern>/verify/*</url-pattern>
        <url-pattern>/api/*</url-pattern>
        <url-pattern>/file/*</url-pattern>
        <url-pattern>/print/*</url-pattern>
        <url-pattern>/op/*</url-pattern>
        <!-- /dl/firmware was intentionally omitted here -->
        <url-pattern>/dl/backup/*</url-pattern>
        <url-pattern>/dl/support/*</url-pattern>
        <url-pattern>/dl/site/*</url-pattern>
        <url-pattern>/upload/*</url-pattern>
    </filter-mapping>

    <filter-mapping>
        <filter-name>UrlRewriteFilter</filter-name>
        <url-pattern>/find_controller</url-pattern>
        <url-pattern>/hotspot/*</url-pattern>
        <url-pattern>/manage/*</url-pattern>
        <url-pattern>/login/*</url-pattern>
        <url-pattern>/hotspot/login/*</url-pattern>
        <url-pattern>/sso_login/*</url-pattern>
        <url-pattern>/verify/*</url-pattern>
        <url-pattern>/wizard/*</url-pattern>
    </filter-mapping>

    <filter-mapping>
        <filter-name>ResourceFilter</filter-name>
        <servlet-name>default</servlet-name>
    </filter-mapping>

    <!--  use the Deny version to prevent anyone, including yourself, from framing the page
    <filter-mapping>
        <filter-name>ClickjackFilterDeny</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    -->

    <!-- use the SameOrigin version to allow your application to frame, but nobody else -->
    <filter-mapping>
        <filter-name>ClickjackFilterSameOrigin</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <security-constraint>
        <web-resource-collection>
            <web-resource-name>Management UI</web-resource-name>
            <url-pattern>/api/*</url-pattern>
        </web-resource-collection>
        <web-resource-collection>
            <web-resource-name>Management UI</web-resource-name>
            <url-pattern>/manage/*</url-pattern>
        </web-resource-collection>
        <web-resource-collection>
            <web-resource-name>Management UI</web-resource-name>
            <url-pattern>/find_controller</url-pattern>
        </web-resource-collection>
        <web-resource-collection>
            <web-resource-name>Management UI</web-resource-name>
            <url-pattern>/hotspot/*</url-pattern>
        </web-resource-collection>
        <web-resource-collection>
            <web-resource-name>Management UI</web-resource-name>
            <url-pattern>/wizard/*</url-pattern>
        </web-resource-collection>
        <user-data-constraint>
            <transport-guarantee>CONFIDENTIAL</transport-guarantee>
        </user-data-constraint>
    </security-constraint>

    <session-config>
        <session-timeout>60</session-timeout>
    </session-config>

    <!-- normal processing of resources -->
    <servlet-mapping>
        <servlet-name>default</servlet-name>
        <url-pattern>/unifi/js/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>default</servlet-name>
        <url-pattern>/unifi/config/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>default</servlet-name>
        <url-pattern>/unifi/locales/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>default</servlet-name>
        <url-pattern>/unifi/css/*</url-pattern>
    </servlet-mapping>
</web-app>
