web.xml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
  3. <display-name>ncjtEntranceGuard</display-name>
  4. <welcome-file-list>
  5. <welcome-file>index.html</welcome-file>
  6. <welcome-file>index.htm</welcome-file>
  7. <welcome-file>index.jsp</welcome-file>
  8. <welcome-file>default.html</welcome-file>
  9. <welcome-file>default.htm</welcome-file>
  10. <welcome-file>default.jsp</welcome-file>
  11. </welcome-file-list>
  12. <!-- log4j配置 4项 -->
  13. <context-param>
  14. <param-name>log4jConfigLocation</param-name>
  15. <param-value>classpath:log4j.properties</param-value>
  16. </context-param>
  17. <context-param>
  18. <param-name>log4jRefreshInterval</param-name>
  19. <param-value>60000</param-value>
  20. </context-param>
  21. <listener>
  22. <listener-class>
  23. org.springframework.web.util.Log4jConfigListener
  24. </listener-class>
  25. </listener>
  26. <!-- <listener> -->
  27. <!-- <listener-class> -->
  28. <!-- org.springframework.web.context.ContextLoaderListener -->
  29. <!-- </listener-class> -->
  30. <!-- </listener> -->
  31. <!-- 指定Spring配置文件的路径 -->
  32. <context-param>
  33. <param-name>contextConfigLocation</param-name>
  34. <param-value>classpath:spring/spring_*.xml</param-value>
  35. </context-param>
  36. <!-- 在监听器中启用Spring -->
  37. <listener>
  38. <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  39. </listener>
  40. <!-- 随容器启动SpringMVC的前端控制器 -->
  41. <servlet>
  42. <servlet-name>springDispatcherServlet</servlet-name>
  43. <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
  44. <init-param>
  45. <param-name>contextConfigLocation</param-name>
  46. <param-value>classpath:springmvc/springmvc.xml</param-value>
  47. </init-param>
  48. <load-on-startup>1</load-on-startup>
  49. </servlet>
  50. <!-- 配置由SpringMVC映射的请求链接 -->
  51. <!-- /表示所有的请求链接都由SpringMVC处理 -->
  52. <servlet-mapping>
  53. <servlet-name>springDispatcherServlet</servlet-name>
  54. <url-pattern>/</url-pattern>
  55. </servlet-mapping>
  56. <!-- 配置编码过滤器 -->
  57. <!-- 解决post乱码 -->
  58. <filter>
  59. <filter-name>CharacterEncodingFilter</filter-name>
  60. <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
  61. <init-param>
  62. <param-name>encoding</param-name>
  63. <param-value>utf-8</param-value>
  64. </init-param>
  65. </filter>
  66. <filter-mapping>
  67. <filter-name>CharacterEncodingFilter</filter-name>
  68. <url-pattern>/*</url-pattern>
  69. </filter-mapping>
  70. <!-- 全局鉴权过滤器:默认拦截所有请求,仅放行白名单(见 Manage_map)。
  71. 如需临时额外放行若干路径,取消下面 init-param 的注释并填写,
  72. 多个用逗号分隔,以 * 结尾表示前缀匹配,例:/getSchoolMapAndWeichat,/test* -->
  73. <filter>
  74. <filter-name>token</filter-name>
  75. <filter-class>com.ncjt.ch.sm.filter.TokenFilter</filter-class>
  76. <!--
  77. <init-param>
  78. <param-name>excludedPaths</param-name>
  79. <param-value></param-value>
  80. </init-param>
  81. -->
  82. </filter>
  83. <filter-mapping>
  84. <filter-name>token</filter-name>
  85. <url-pattern>/*</url-pattern>
  86. </filter-mapping>
  87. <!-- JNDI lookup for name抛出异常问题 -->
  88. <context-param>
  89. <param-name>spring.profiles.active</param-name>
  90. <param-value>dev</param-value>
  91. </context-param>
  92. <context-param>
  93. <param-name>spring.profiles.default</param-name>
  94. <param-value>dev</param-value>
  95. </context-param>
  96. <context-param>
  97. <param-name>spring.liveBeansView.mbeanDomain</param-name>
  98. <param-value>dev</param-value>
  99. </context-param>
  100. </web-app>