peternameyakj
2024-07-21 25e1d54f2295934446473fe85cf022fa6140b4e0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<?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"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
         version="3.0">
 
  <welcome-file-list>
    <welcome-file>login.jsp</welcome-file>
  </welcome-file-list>
 
  <!--加载Spring的配置文件到上下文中去-->
      <context-param>
        <param-name>contextConfigLocation</param-name>
         <param-value>classpath*:spring/applicationContext.xml</param-value>
<!--        <param-value>classpath*:spring/*.xml</param-value>-->
    </context-param>
 
  <servlet>
    <servlet-name>jsp</servlet-name>
    <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
    <init-param>
        <param-name>fork</param-name>
        <param-value>false</param-value>
    </init-param>
    <init-param>
        <param-name>xpoweredBy</param-name>
        <param-value>false</param-value>
    </init-param>
    <init-param>
        <param-name>mappedfile</param-name>
        <param-value>false</param-value>
    </init-param>
    <load-on-startup>3</load-on-startup>
  </servlet>
 
  <!-- spring MVC config start-->
  <servlet>
    <servlet-name>spring</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
      <param-name>contextConfigLocation</param-name>
      <!-- 此处指向的的是SpringMVC的配置文件 -->
      <param-value>classpath:spring-mvc.xml</param-value>
    </init-param>
    <!--配置容器在启动的时候就加载这个servlet并实例化-->
    <load-on-startup>1</load-on-startup>
  </servlet>
 
  <servlet-mapping>
    <servlet-name>spring</servlet-name>
    <url-pattern>/</url-pattern>
  </servlet-mapping>
  <!-- spring MVC config end-->
 
  <!-- Spring监听器 -->
  <listener>
    <listener-class>kernel.web.SpringWebContextListener</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>
 
  <!--配置过滤器-->
  <filter>
      <filter-name>AllRequestFilter</filter-name>
      <filter-class>project.web.admin.filter.AllRequestFilter</filter-class>
  </filter>
  <!--映射过滤器-->
  <filter-mapping>
      <filter-name>AllRequestFilter</filter-name>
      <url-pattern>/*</url-pattern>
  </filter-mapping>
 
  <!--配置过滤器-->
  <filter>
      <filter-name>urlResourceFilterInvocation</filter-name>
      <filter-class>security.filter.UrlResourceFilterInvocation</filter-class>
  </filter>
  <!--映射过滤器-->
  <filter-mapping>
      <filter-name>urlResourceFilterInvocation</filter-name>
      <url-pattern>/*</url-pattern>
  </filter-mapping>
 
</web-app>