web.xml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
  5. http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
  6. version="3.1" metadata-complete="false">
  7. <context-param>
  8. <param-name>contextConfigLocation</param-name>
  9. <param-value>
  10. classpath:spring-mvc.xml
  11. classpath:spring-jdbc.xml
  12. classpath*:platform-*.xml
  13. </param-value>
  14. </context-param>
  15. <context-param>
  16. <param-name>log4jRefreshInterval</param-name>
  17. <param-value>600000</param-value>
  18. </context-param>
  19. <context-param>
  20. <param-name>webAppRootKey</param-name>
  21. <param-value>webPath</param-value>
  22. </context-param>
  23. <listener>
  24. <listener-class>org.springframework.web.util.WebAppRootListener</listener-class>
  25. </listener>
  26. <listener>
  27. <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  28. </listener>
  29. <filter>
  30. <filter-name>encodingFilter</filter-name>
  31. <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
  32. <init-param>
  33. <param-name>encoding</param-name>
  34. <param-value>UTF-8</param-value>
  35. </init-param>
  36. </filter>
  37. <filter-mapping>
  38. <filter-name>encodingFilter</filter-name>
  39. <url-pattern>/*</url-pattern>
  40. </filter-mapping>
  41. <!-- 配置Shiro过滤器,先让Shiro过滤系统接收到的请求 -->
  42. <!-- 这里filter-name必须对应applicationContext.xml中定义的<bean id="shiroFilter"/> -->
  43. <!-- 使用[/*]匹配所有请求,保证所有的可控请求都经过Shiro的过滤 -->
  44. <!-- 通常会将此filter-mapping放置到最前面(即其他filter-mapping前面),以保证它是过滤器链中第一个起作用的 -->
  45. <filter>
  46. <filter-name>shiroFilter</filter-name>
  47. <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
  48. <init-param>
  49. <!-- 该值缺省为false,表示生命周期由SpringApplicationContext管理,设置为true则表示由servlet container管理 -->
  50. <param-name>targetFilterLifecycle</param-name>
  51. <param-value>true</param-value>
  52. </init-param>
  53. </filter>
  54. <filter-mapping>
  55. <filter-name>shiroFilter</filter-name>
  56. <url-pattern>/*</url-pattern>
  57. </filter-mapping>
  58. <filter>
  59. <filter-name>xssFilter</filter-name>
  60. <filter-class>com.platform.xss.XssFilter</filter-class>
  61. <init-param>
  62. <!--凡是提交包含html内容的请求都要写在这里,若有多个以逗号隔开-->
  63. <param-name>excludedPages</param-name>
  64. <param-value>/topic/update,/topic/save,/goods/save,/goods/update</param-value>
  65. </init-param>
  66. </filter>
  67. <filter-mapping>
  68. <filter-name>xssFilter</filter-name>
  69. <url-pattern>/*</url-pattern>
  70. </filter-mapping>
  71. <servlet>
  72. <servlet-name>dispatcher</servlet-name>
  73. <servlet-class>
  74. org.springframework.web.servlet.DispatcherServlet
  75. </servlet-class>
  76. <load-on-startup>1</load-on-startup>
  77. </servlet>
  78. <servlet-mapping>
  79. <servlet-name>dispatcher</servlet-name>
  80. <url-pattern>/</url-pattern>
  81. </servlet-mapping>
  82. <servlet>
  83. <servlet-name>DruidStatView</servlet-name>
  84. <servlet-class>com.alibaba.druid.support.http.StatViewServlet</servlet-class>
  85. </servlet>
  86. <servlet-mapping>
  87. <servlet-name>DruidStatView</servlet-name>
  88. <url-pattern>/druid/*</url-pattern>
  89. </servlet-mapping>
  90. <error-page>
  91. <error-code>404</error-code>
  92. <location>/404.html</location>
  93. </error-page>
  94. </web-app>