<?xml version="1.0" encoding="UTF-8"?>
<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" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee"
         id="WebApp_ID" version="2.5">
    <display-name>ServiceManager</display-name>
    <welcome-file-list>
        <welcome-file>manager.jsp</welcome-file>
        <welcome-file>index.htm</welcome-file>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>default.html</welcome-file>
        <welcome-file>default.htm</welcome-file>
        <welcome-file>default.jsp</welcome-file>
    </welcome-file-list>

    <filter>
        <filter-name>CorsFilter</filter-name>
        <filter-class>com.auraplayer.http.filters.CORSFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>CorsFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    
    <filter>
        <filter-name>CompressingFilter</filter-name>
        <filter-class>com.github.ziplet.filter.compression.CompressingFilter</filter-class>
        <init-param>
            <param-name>debug</param-name>
            <param-value>false</param-value>
        </init-param>
        <init-param>
            <param-name>statsEnabled</param-name>
            <param-value>false</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>CompressingFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
	
    <security-constraint>
        <web-resource-collection>
            <web-resource-name>All</web-resource-name>
            <url-pattern>*.jsp</url-pattern>
            <http-method>GET</http-method>
            <http-method>PUT</http-method>
            <http-method>POST</http-method>
            <http-method>PATCH</http-method>
        </web-resource-collection>
        <auth-constraint>
            <role-name>webuser</role-name>
            <role-name>manager</role-name>
            <role-name>limited_developer</role-name>
            <role-name>developer</role-name>
            <role-name>operator</role-name>
			<role-name>GRP_AURAPLAYER_WEBUSER</role-name>
			<role-name>GRP_AURAPLAYER_MANAGER</role-name>
			<role-name>GRP_AURAPLAYER_DEVELOPER</role-name>
			<role-name>GRP_AURAPLAYER_OPERATOR</role-name>
        </auth-constraint>
    </security-constraint>


    <login-config>
        <auth-method>FORM</auth-method>
        <form-login-config>
            <form-login-page>/login.jsp</form-login-page>
            <form-error-page>/login_failed.jsp</form-error-page>
        </form-login-config>
    </login-config>

    <security-role>
        <role-name>webuser</role-name>
    </security-role>
    <security-role>
        <role-name>manager</role-name>
    </security-role>
    <security-role>
        <role-name>limited_developer</role-name>
    </security-role>
    <security-role>
        <role-name>developer</role-name>
    </security-role>
    <security-role>
        <role-name>operator</role-name>
    </security-role>
    <security-role>
        <role-name>GRP_AURAPLAYER_WEBUSER</role-name>
    </security-role>	
    <security-role>
        <role-name>GRP_AURAPLAYER_MANAGER</role-name>
    </security-role>	
	    <security-role>
        <role-name>GRP_AURAPLAYER_DEVELOPER</role-name>
    </security-role>	
    <security-role>
        <role-name>GRP_AURAPLAYER_OPERATOR</role-name>
    </security-role>		
    
    <context-param>
        <param-name>org.restlet.application</param-name>
        <param-value>
            com.auraplayer.rest.config.ApplicationRoot
        </param-value>
    </context-param>
    <servlet>
        <servlet-name>RestletServlet</servlet-name>
        <servlet-class>
            org.restlet.ext.servlet.ServerServlet
        </servlet-class>
		
		<security-role-ref>
			<role-name>webuser</role-name>
			<role-link>GRP_AURAPLAYER_WEBUSER</role-link>
		</security-role-ref>
		<security-role-ref>
			<role-name>manager</role-name>
			<role-link>GRP_AURAPLAYER_MANAGER</role-link>
		</security-role-ref>
		<security-role-ref>
			<role-name>developer</role-name>
			<role-link>GRP_AURAPLAYER_DEVELOPER</role-link>
		</security-role-ref>
		<security-role-ref>
			<role-name>operator</role-name>
			<role-link>GRP_AURAPLAYER_OPERATOR</role-link>
		</security-role-ref>		
    </servlet>
    <servlet-mapping>
        <servlet-name>RestletServlet</servlet-name>
        <url-pattern>/Macro/*</url-pattern>
    </servlet-mapping>
    <listener>
        <listener-class>com.auraplayer.macromanager.InitServletListener</listener-class>
    </listener>
    
    <servlet>
        <description>Receives file from applet</description>
        <display-name>uploadRecordedMacro</display-name>
        <servlet-name>uploadRecordedMacro</servlet-name>
        <servlet-class>com.auraplayer.servlets.uploadRecordedMacro</servlet-class>
		
		<security-role-ref>
			<role-name>webuser</role-name>
			<role-link>GRP_AURAPLAYER_WEBUSER</role-link>
		</security-role-ref>
		<security-role-ref>
			<role-name>manager</role-name>
			<role-link>GRP_AURAPLAYER_MANAGER</role-link>
		</security-role-ref>
		<security-role-ref>
			<role-name>developer</role-name>
			<role-link>GRP_AURAPLAYER_DEVELOPER</role-link>
		</security-role-ref>
		<security-role-ref>
			<role-name>operator</role-name>
			<role-link>GRP_AURAPLAYER_OPERATOR</role-link>
		</security-role-ref>		
    </servlet>
    <servlet-mapping>
        <servlet-name>uploadRecordedMacro</servlet-name>
        <url-pattern>/uploadRecordedMacro</url-pattern>
    </servlet-mapping>
    
    <servlet>
        <description>Serves content from local folder</description>
        <display-name>local</display-name>
        <servlet-name>local</servlet-name>
        <servlet-class>com.auraplayer.servlets.LocalFolderServlet</servlet-class>
		
		<security-role-ref>
			<role-name>webuser</role-name>
			<role-link>GRP_AURAPLAYER_WEBUSER</role-link>
		</security-role-ref>
		<security-role-ref>
			<role-name>manager</role-name>
			<role-link>GRP_AURAPLAYER_MANAGER</role-link>
		</security-role-ref>
		<security-role-ref>
			<role-name>developer</role-name>
			<role-link>GRP_AURAPLAYER_DEVELOPER</role-link>
		</security-role-ref>
		<security-role-ref>
			<role-name>operator</role-name>
			<role-link>GRP_AURAPLAYER_OPERATOR</role-link>
		</security-role-ref>		
    </servlet>
    <servlet-mapping>
        <servlet-name>local</servlet-name>
        <url-pattern>/data/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>local</servlet-name>
        <url-pattern>/apps/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>local</servlet-name>
        <url-pattern>/www/*</url-pattern>
    </servlet-mapping>
</web-app>
