<?xml version="1.0" encoding="UTF-8"?>
<web-app>
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>
            /WEB-INF/applicationContext.xml
            /WEB-INF/springContext-dnetOpenaireUsersService.xml
        </param-value>
    </context-param>
    <context-param>
        <param-name>log4jConfigLocation</param-name>
        <param-value>/WEB-INF/log4j.properties</param-value>
    </context-param>

    <listener>
        <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
    </listener>
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

    <filter>
        <filter-name>encodingFilter</filter-name>
        <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
        <init-param>
            <param-name>encoding</param-name>
            <param-value>UTF-8</param-value>
        </init-param>
        <init-param>
            <param-name>forceEncoding</param-name>
            <param-value>true</param-value>
        </init-param>
    </filter>

    <filter-mapping>
        <filter-name>encodingFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    <servlet>
        <servlet-name>User API</servlet-name>
        <servlet-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</servlet-class>
        <init-param>
            <param-name>com.sun.jersey.config.property.packages</param-name>
            <param-value>eu.dnetlib.openaire.usermanagement.api</param-value>
        </init-param>
    </servlet>
    <servlet-mapping>
        <servlet-name>User API</servlet-name>
        <url-pattern>/api/*</url-pattern>
    </servlet-mapping>

    <servlet>
        <servlet-name>ForgotPasswordServlet</servlet-name>
        <display-name>Forgot Password</display-name>
        <servlet-class>eu.dnetlib.openaire.usermanagement.ForgotPasswordServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>ForgotPasswordServlet</servlet-name>
        <url-pattern>/forgotPassword</url-pattern>
    </servlet-mapping>

    <servlet>
        <servlet-name>RegisterServlet</servlet-name>
        <display-name>Register</display-name>
        <servlet-class>eu.dnetlib.openaire.usermanagement.RegisterServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>RegisterServlet</servlet-name>
        <url-pattern>/register</url-pattern>
    </servlet-mapping>

    <servlet>
        <servlet-name>OverviewServlet</servlet-name>
        <display-name>Overview</display-name>
        <servlet-class>eu.dnetlib.openaire.usermanagement.OverviewServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>OverviewServlet</servlet-name>
        <url-pattern>/overview</url-pattern>
    </servlet-mapping>

    <servlet>
        <servlet-name>VerificationCodeServlet</servlet-name>
        <display-name>Verify code</display-name>
        <servlet-class>eu.dnetlib.openaire.usermanagement.VerificationCodeServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>VerificationCodeServlet</servlet-name>
        <url-pattern>/verifyCode</url-pattern>
    </servlet-mapping>

    <servlet>
        <servlet-name>ActivationCodeServlet</servlet-name>
        <display-name>Activate</display-name>
        <servlet-class>eu.dnetlib.openaire.usermanagement.ActivationCodeServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>ActivationCodeServlet</servlet-name>
        <url-pattern>/activate</url-pattern>
    </servlet-mapping>


    <servlet>
        <servlet-name>ResetPasswordServlet</servlet-name>
        <display-name>Reset password</display-name>
        <servlet-class>eu.dnetlib.openaire.usermanagement.ResetPasswordServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>ResetPasswordServlet</servlet-name>
        <url-pattern>/resetPassword</url-pattern>
    </servlet-mapping>

    <servlet>
        <servlet-name>RemindUsernameServlet</servlet-name>
        <display-name>Username Reminder</display-name>
        <servlet-class>eu.dnetlib.openaire.usermanagement.RemindUsernameServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>RemindUsernameServlet</servlet-name>
        <url-pattern>/remindUsername</url-pattern>
    </servlet-mapping>

    <servlet>
        <servlet-name>RequestActivationCodeServlet</servlet-name>
        <display-name>Request an activation code</display-name>
        <servlet-class>eu.dnetlib.openaire.usermanagement.RequestActivationCodeServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>RequestActivationCodeServlet</servlet-name>
        <url-pattern>/requestActivationCode</url-pattern>
    </servlet-mapping>

    <servlet>
        <servlet-name>RequestToDeleteAccountServlet</servlet-name>
        <display-name>Request to delete an account</display-name>
        <servlet-class>eu.dnetlib.openaire.usermanagement.RequestToDeleteAccountServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>RequestToDeleteAccountServlet</servlet-name>
        <url-pattern>/requestToDeleteAccount</url-pattern>
    </servlet-mapping>

    <servlet>
        <servlet-name>VerifyToDeletServlet</servlet-name>
        <display-name>Verify to delete an account</display-name>
        <servlet-class>eu.dnetlib.openaire.usermanagement.VerifyToDeleteServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>VerifyToDeletServlet</servlet-name>
        <url-pattern>/verifyToDelete</url-pattern>
    </servlet-mapping>

    <servlet>
        <servlet-name>PersonalTokenServlet</servlet-name>
        <display-name>Activate</display-name>
        <servlet-class>eu.dnetlib.openaire.usermanagement.PersonalTokenServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>PersonalTokenServlet</servlet-name>
        <url-pattern>/personalToken</url-pattern>
    </servlet-mapping>

    <servlet>
        <servlet-name>RegisterServiceServlet</servlet-name>
        <display-name>Activate</display-name>
        <servlet-class>eu.dnetlib.openaire.usermanagement.RegisterServiceServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>RegisterServiceServlet</servlet-name>
        <url-pattern>/registerService</url-pattern>
    </servlet-mapping>

    <servlet>
        <servlet-name>RegisteredServicesServlet</servlet-name>
        <display-name>Activate</display-name>
        <servlet-class>eu.dnetlib.openaire.usermanagement.RegisteredServicesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>RegisteredServicesServlet</servlet-name>
        <url-pattern>/registeredServices</url-pattern>
    </servlet-mapping>

    <servlet>
        <servlet-name>EmailConfirmationServlet</servlet-name>
        <display-name>EmailConfirmation</display-name>
        <servlet-class>eu.dnetlib.openaire.usermanagement.EmailConfirmationServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>EmailConfirmationServlet</servlet-name>
        <url-pattern>/email-confirmation</url-pattern>
    </servlet-mapping>

    <filter>
        <filter-name>CorsFilter</filter-name>
        <filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
        <init-param>
            <param-name>cors.allowed.origins</param-name>
            <param-value>*</param-value>
        </init-param>
        <init-param>
            <param-name>cors.allowed.methods</param-name>
            <param-value>GET, POST, DELETE, OPTIONS</param-value>
        </init-param>
        <init-param>
            <param-name>cors.exposed.headers</param-name>
            <param-value>Access-Control-Allow-Origin,Access-Control-Allow-Credentials,Access-Control-Allow-Methods</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>CorsFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <filter>
        <filter-name>springSessionRepositoryFilter</filter-name>
        <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>springSessionRepositoryFilter</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>ERROR</dispatcher>
    </filter-mapping>

    <filter>
        <filter-name>springSecurityFilterChain</filter-name>
        <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    </filter>

    <filter-mapping>
        <filter-name>springSecurityFilterChain</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <!--error-page>
        <error-code>500</error-code>
        <location>/error.jsp</location>
    </error-page>

    <error-page>
        <error-code>400</error-code>
        <location>/error.jsp</location>
    </error-page>

    <error-page>
        <error-code>403</error-code>
        <location>/error.jsp</location>
    </error-page>

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

    <error-page>
        <error-code>405</error-code>
        <location>/error.jsp</location>
    </error-page-->

</web-app>
