<?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_4_0.xsd"
         version="4.0">

    <display-name>MZH 图书馆管理系统</display-name>

    <filter>
        <filter-name>CharacterEncodingFilter</filter-name>
        <filter-class>com.mzh.library.filter.CharacterEncodingFilter</filter-class>
        <init-param>
            <param-name>encoding</param-name>
            <param-value>UTF-8</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>CharacterEncodingFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <filter>
        <filter-name>AuthenticationFilter</filter-name>
        <filter-class>com.mzh.library.filter.AuthenticationFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>AuthenticationFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <filter>
        <filter-name>AuthorizationFilter</filter-name>
        <filter-class>com.mzh.library.filter.AuthorizationFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>AuthorizationFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <servlet>
        <servlet-name>LoginServlet</servlet-name>
        <servlet-class>com.mzh.library.controller.LoginServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>LoginServlet</servlet-name>
        <url-pattern>/login</url-pattern>
    </servlet-mapping>

    <servlet>
        <servlet-name>LogoutServlet</servlet-name>
        <servlet-class>com.mzh.library.controller.LogoutServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>LogoutServlet</servlet-name>
        <url-pattern>/logout</url-pattern>
    </servlet-mapping>

    <servlet>
        <servlet-name>DashboardServlet</servlet-name>
        <servlet-class>com.mzh.library.controller.DashboardServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>DashboardServlet</servlet-name>
        <url-pattern>/dashboard</url-pattern>
    </servlet-mapping>

    <servlet>
        <servlet-name>RoleAreaServlet</servlet-name>
        <servlet-class>com.mzh.library.controller.RoleAreaServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>RoleAreaServlet</servlet-name>
        <url-pattern>/admin/home</url-pattern>
        <url-pattern>/librarian/home</url-pattern>
        <url-pattern>/reader/home</url-pattern>
    </servlet-mapping>

    <servlet>
        <servlet-name>UserManagementServlet</servlet-name>
        <servlet-class>com.mzh.library.controller.UserManagementServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>UserManagementServlet</servlet-name>
        <url-pattern>/admin/users</url-pattern>
        <url-pattern>/admin/users/new</url-pattern>
        <url-pattern>/admin/users/edit</url-pattern>
        <url-pattern>/admin/users/update</url-pattern>
        <url-pattern>/admin/users/deactivate</url-pattern>
    </servlet-mapping>

    <servlet>
        <servlet-name>SystemLogServlet</servlet-name>
        <servlet-class>com.mzh.library.controller.SystemLogServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>SystemLogServlet</servlet-name>
        <url-pattern>/admin/system-logs</url-pattern>
    </servlet-mapping>

    <servlet>
        <servlet-name>BookCatalogServlet</servlet-name>
        <servlet-class>com.mzh.library.controller.BookCatalogServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>BookCatalogServlet</servlet-name>
        <url-pattern>/catalog</url-pattern>
    </servlet-mapping>

    <servlet>
        <servlet-name>BookManagementServlet</servlet-name>
        <servlet-class>com.mzh.library.controller.BookManagementServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>BookManagementServlet</servlet-name>
        <url-pattern>/books</url-pattern>
        <url-pattern>/books/new</url-pattern>
        <url-pattern>/books/edit</url-pattern>
        <url-pattern>/books/update</url-pattern>
        <url-pattern>/books/delete</url-pattern>
        <url-pattern>/book-categories</url-pattern>
        <url-pattern>/book-categories/new</url-pattern>
        <url-pattern>/book-categories/edit</url-pattern>
        <url-pattern>/book-categories/update</url-pattern>
        <url-pattern>/book-categories/delete</url-pattern>
    </servlet-mapping>

    <servlet>
        <servlet-name>ReaderManagementServlet</servlet-name>
        <servlet-class>com.mzh.library.controller.ReaderManagementServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>ReaderManagementServlet</servlet-name>
        <url-pattern>/readers</url-pattern>
        <url-pattern>/readers/new</url-pattern>
        <url-pattern>/readers/edit</url-pattern>
        <url-pattern>/readers/update</url-pattern>
        <url-pattern>/readers/delete</url-pattern>
    </servlet-mapping>

    <servlet>
        <servlet-name>BorrowingManagementServlet</servlet-name>
        <servlet-class>com.mzh.library.controller.BorrowingManagementServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>BorrowingManagementServlet</servlet-name>
        <url-pattern>/borrowing</url-pattern>
        <url-pattern>/borrowing/new</url-pattern>
        <url-pattern>/borrowing/create</url-pattern>
        <url-pattern>/borrowing/return</url-pattern>
        <url-pattern>/borrowing/renew</url-pattern>
    </servlet-mapping>

    <servlet>
        <servlet-name>ReaderLoanHistoryServlet</servlet-name>
        <servlet-class>com.mzh.library.controller.ReaderLoanHistoryServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>ReaderLoanHistoryServlet</servlet-name>
        <url-pattern>/reader/loans</url-pattern>
    </servlet-mapping>

    <servlet>
        <servlet-name>ReportServlet</servlet-name>
        <servlet-class>com.mzh.library.controller.ReportServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>ReportServlet</servlet-name>
        <url-pattern>/reports</url-pattern>
    </servlet-mapping>

    <servlet>
        <servlet-name>UnauthorizedServlet</servlet-name>
        <servlet-class>com.mzh.library.controller.UnauthorizedServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>UnauthorizedServlet</servlet-name>
        <url-pattern>/unauthorized</url-pattern>
    </servlet-mapping>

    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
</web-app>
