<?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">

	<display-name>ssmbootstrap-table</display-name>
	<context-param>
		<description>
			关于Spring profile:在确定哪个profile处于激活状态时，需要依赖两个独立的属性：spring.profiles.active和spring.profiles.default。如果设置了spring.profiles.active属性的话，
			那么它的值就会用来确定哪个profile是激活的。但如果没有设置spring.profiles.active属性的话，那Spring将会查找spring.profiles.default的值。如果spring.profiles.active和spring.profiles.default均没有设置的话，
			那就没有激活的profile，因此只会创建那些没有定义在profile中的bean;当应用程序部署到QA、生产或其他环境之中时，负责部署的人根据情况使用系统属性、环境变量或JNDI设置spring.profiles.active即可。
			当设置spring.profiles.active以后，至于spring.profiles.default置成什么值就已经无所谓了；系统会优先使用spring.profiles.active中所设置的profile
		</description>
		<param-name>spring.profiles.default</param-name>
		<param-value>develop</param-value>
	</context-param>
	<context-param>
		<param-name>webAppRootKey</param-name>
		<param-value>webapp.root</param-value>
	</context-param>
	<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>
			classpath:spring/spring-context.xml
		</param-value>
	</context-param>

	<filter>
		<filter-name>encodingFilter</filter-name>
		<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
		<async-supported>true</async-supported>
		<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>
		<dispatcher>ASYNC</dispatcher>
		<dispatcher>ERROR</dispatcher>
		<dispatcher>FORWARD</dispatcher>
		<dispatcher>INCLUDE</dispatcher>
		<dispatcher>REQUEST</dispatcher>
	</filter-mapping>

	<filter>
		<filter-name>domainFilter</filter-name>
		<filter-class>cn.netbuffer.ssmbootstrap_table.filter.DomainFilter</filter-class>
		<async-supported>true</async-supported>
		<init-param>
			<param-name>enable</param-name>
			<param-value>false</param-value>
		</init-param>
	</filter>
	<filter-mapping>
		<filter-name>domainFilter</filter-name>
		<url-pattern>/*</url-pattern>
		<dispatcher>ASYNC</dispatcher>
		<dispatcher>ERROR</dispatcher>
		<dispatcher>FORWARD</dispatcher>
		<dispatcher>INCLUDE</dispatcher>
		<dispatcher>REQUEST</dispatcher>
	</filter-mapping>

	<filter>
		<filter-name>injectionAttackFilter</filter-name>
		<filter-class>cn.netbuffer.ssmbootstrap_table.filter.InjectionAttackFilter</filter-class>
		<async-supported>true</async-supported>
		<!-- optional parameters. values given are the defaults. they can be set 
			to false or removed to disable. -->
		<init-param>
			<param-name>filter_xss</param-name>
			<param-value>true</param-value>
		</init-param>
		<init-param>
			<param-name>filter_sql_injection</param-name>
			<param-value>true</param-value>
		</init-param>
		<init-param>
			<!-- adds X-FRAME-OPTIONS -> SAMEORIGIN to all HttpServletResponses. Will 
				not overwrite existing X-FRAME-OPTIONS header -->
			<param-name>click_jacking_header</param-name>
			<param-value>true</param-value>
		</init-param>
	</filter>
	<filter-mapping>
		<filter-name>injectionAttackFilter</filter-name>
		<url-pattern>/*</url-pattern>
		<dispatcher>ASYNC</dispatcher>
		<dispatcher>ERROR</dispatcher>
		<dispatcher>FORWARD</dispatcher>
		<dispatcher>INCLUDE</dispatcher>
		<dispatcher>REQUEST</dispatcher>
	</filter-mapping>
	
	<!-- 使用spring管理filter，可以在filter中拿到spring容器中的依赖 -->
	<filter>
		<filter-name>LoginFilter</filter-name>
		<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
		<async-supported>true</async-supported>
		<init-param>
			<param-name>targetBeanName</param-name>
			<param-value>loginFilter</param-value>
		</init-param>
		<init-param>  
	        <param-name>targetFilterLifecycle</param-name>  
	        <param-value>true</param-value>  
        </init-param>
        <init-param>
			<param-name>enable</param-name>
			<param-value>true</param-value>
		</init-param> 
		<init-param>
			<param-name>noFilterTags</param-name>
			<param-value>
				/*/index.html*
				/*/login/**
				/*/register/**
				/*/captcha/**
				/*/static/**
				/*/css/**
				/*/js/**
				/*/image/**
				/*/jsonp/**
				/*/cxf/**
				/testservlet
			</param-value>
		</init-param>
	</filter>
	<filter-mapping>
		<filter-name>LoginFilter</filter-name>
		<url-pattern>/*</url-pattern>
		<dispatcher>ASYNC</dispatcher>
		<dispatcher>ERROR</dispatcher>
		<dispatcher>FORWARD</dispatcher>
		<dispatcher>INCLUDE</dispatcher>
		<dispatcher>REQUEST</dispatcher>
	</filter-mapping>

	<filter>
		<filter-name>druidfilter</filter-name>
		<filter-class>com.alibaba.druid.support.http.WebStatFilter</filter-class>
		<async-supported>true</async-supported>
		<init-param>
			<param-name>exclusions</param-name>
			<param-value>*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*</param-value>
		</init-param>
	</filter>
	<filter-mapping>
		<filter-name>druidfilter</filter-name>
		<url-pattern>/*</url-pattern>
		<dispatcher>ASYNC</dispatcher>
		<dispatcher>ERROR</dispatcher>
		<dispatcher>FORWARD</dispatcher>
		<dispatcher>INCLUDE</dispatcher>
		<dispatcher>REQUEST</dispatcher>
	</filter-mapping>

	<!-- jsonp refer检测 -->
	<filter>
		<filter-name>jsonpReferFilter</filter-name>
		<filter-class>cn.netbuffer.ssmbootstrap_table.filter.JsonpReferFilter</filter-class>
		<async-supported>true</async-supported>
		<init-param>
			<param-name>enable</param-name>
			<param-value>false</param-value>
		</init-param>
		<init-param>
			<param-name>refers</param-name>
			<param-value>www.abc.com;www.bcd.com</param-value>
		</init-param>
	</filter>

	<filter-mapping>
		<filter-name>jsonpReferFilter</filter-name>
		<url-pattern>*.json</url-pattern>
		<dispatcher>ASYNC</dispatcher>
		<dispatcher>ERROR</dispatcher>
		<dispatcher>FORWARD</dispatcher>
		<dispatcher>INCLUDE</dispatcher>
		<dispatcher>REQUEST</dispatcher>
	</filter-mapping>

	<!-- jsonp支持 -->
	<filter>
		<filter-name>jsonpCallbackFilter</filter-name>
		<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
		<async-supported>true</async-supported>
	</filter>

	<filter-mapping>
		<filter-name>jsonpCallbackFilter</filter-name>
		<url-pattern>*.json</url-pattern>
	</filter-mapping>

	<filter>
		<filter-name>timerFilter</filter-name>
		<filter-class>cn.netbuffer.ssmbootstrap_table.filter.TimerFilter</filter-class>
		<async-supported>true</async-supported>
		<init-param>
			<param-name>enable</param-name>
			<param-value>true</param-value>
		</init-param>
	</filter>
	<filter-mapping>
		<filter-name>timerFilter</filter-name>
		<url-pattern>/*</url-pattern>
		<dispatcher>ASYNC</dispatcher>
		<dispatcher>ERROR</dispatcher>
		<dispatcher>FORWARD</dispatcher>
		<dispatcher>INCLUDE</dispatcher>
		<dispatcher>REQUEST</dispatcher>
	</filter-mapping>

	<filter>
		<filter-name>trimFilter</filter-name>
		<filter-class>cn.netbuffer.ssmbootstrap_table.filter.TrimFilter</filter-class>
		<async-supported>true</async-supported>
		<init-param>
			<param-name>enable</param-name>
			<param-value>true</param-value>
		</init-param>
	</filter>
	<filter-mapping>
		<filter-name>trimFilter</filter-name>
		<url-pattern>/*</url-pattern>
		<dispatcher>ASYNC</dispatcher>
		<dispatcher>ERROR</dispatcher>
		<dispatcher>FORWARD</dispatcher>
		<dispatcher>INCLUDE</dispatcher>
		<dispatcher>REQUEST</dispatcher>
	</filter-mapping>
	
	<!-- 跨域支持 http://software.dzhuvinov.com/cors-filter-installation.html-->
	<filter>
		<filter-name>CORS</filter-name>
		<filter-class>com.thetransactioncompany.cors.CORSFilter</filter-class>
		<async-supported>true</async-supported>
		<init-param>
			<param-name>cors.allowOrigin</param-name>
			<param-value>*</param-value>
		</init-param>
	</filter>
	<filter-mapping>
	        <filter-name>CORS</filter-name>
	        <url-pattern>/*</url-pattern>
	</filter-mapping>

	<!-- ehcache缓存 -->
	<!-- <filter> <filter-name>pagefilter</filter-name> <filter-class>net.sf.ehcache.constructs.web.filter.SimplePageCachingFilter</filter-class> 
		<param-name>cacheName</param-name> <param-value>pagefiltercache</param-value> 
		</filter> <filter-mapping> <filter-name>pagefilter</filter-name> <url-pattern>/*</url-pattern> 
		</filter-mapping> -->

	<listener>
		<listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>
	</listener>
	<listener>
		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
	</listener>
	<listener>
		<listener-class>cn.netbuffer.ssmbootstrap_table.listener.ApplicationListener</listener-class>
	</listener>
	<listener>
		<listener-class>cn.netbuffer.ssmbootstrap_table.listener.HealthCheckServletContextListener</listener-class>
	</listener>
	<listener>
		<listener-class>cn.netbuffer.ssmbootstrap_table.listener.MetricsServletContextListener</listener-class>
	</listener>

	<!-- https://github.com/alibaba/druid/wiki/%E9%85%8D%E7%BD%AE_StatViewServlet%E9%85%8D%E7%BD%AE -->
	<servlet>
		<servlet-name>druidstat</servlet-name>
		<servlet-class>com.alibaba.druid.support.http.StatViewServlet</servlet-class>
		<init-param>
			<!-- 用户名 -->
			<param-name>loginUsername</param-name>
			<param-value>admin</param-value>
		</init-param>
		<init-param>
			<!-- 密码 -->
			<param-name>loginPassword</param-name>
			<param-value>admin</param-value>
		</init-param>
		<init-param>
			<param-name>allow</param-name>
			<param-value>127.0.0.1</param-value>
		</init-param>
		<!-- <init-param> <param-name>deny</param-name> <param-value>128.242.127.4</param-value> 
			</init-param> -->
	</servlet>
	<servlet-mapping>
		<servlet-name>druidstat</servlet-name>
		<url-pattern>/druid/*</url-pattern>
	</servlet-mapping>

	<servlet>
		<servlet-name>SpringMVC</servlet-name>
		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
		<init-param>
			<param-name>contextConfigLocation</param-name>
			<param-value>classpath:spring/spring-mvc.xml</param-value>
		</init-param>
		<init-param>
			<param-name>debug</param-name>
			<param-value>0</param-value>
		</init-param>
		<load-on-startup>0</load-on-startup>
		<!-- http://www.lai18.com/content/2483896.html filter中也需要开启异步支持 -->
		<async-supported>true</async-supported>
	</servlet>
	<servlet-mapping>
		<servlet-name>SpringMVC</servlet-name>
		<!-- <url-pattern>/*</url-pattern> -->
		<!-- csdn连接:http://bbs.csdn.net/topics/390610045 如果使用/*拦截,会直接显示jsp源码了,配置成/会被正确解析 -->
		<url-pattern>/</url-pattern>
	</servlet-mapping>

	<servlet>
		<display-name>CXF Servlet</display-name>
		<servlet-name>CXFServlet</servlet-name>
		<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>
	<servlet-mapping>
		<servlet-name>CXFServlet</servlet-name>
		<url-pattern>/cxf/*</url-pattern>
	</servlet-mapping>
	<!-- http://localhost:8080/ssmbootstrap_table/metrics -->
	<servlet>
		<servlet-name>metrics</servlet-name>
		<servlet-class>com.codahale.metrics.servlets.AdminServlet</servlet-class>
	</servlet>
	<servlet-mapping>
		<servlet-name>metrics</servlet-name>
		<url-pattern>/metrics/*</url-pattern>
	</servlet-mapping>

	<jsp-config>
		<!-- jsp-property-group配置 -->
		<!-- <jsp-property-group> <url-pattern>*.jsp</url-pattern> 禁止EL表达式 设置，禁止后会原样输出 
			<el-ignored>false</el-ignored> 禁止<%%>脚本设置 <scripting-invalid>true</scripting-invalid> 
			抬头 <include-prelude>/prelude.jspf</include-prelude> 结尾 <include-coda>/coda.jspf</include-coda> 
			清除jsp中由于page指令引入带来的空行 <trim-directive-whitespaces>true</trim-directive-whitespaces> 
			</jsp-property-group> -->
		<!-- <jsp-property-group> <url-pattern>/aa/*.jsp</url-pattern> 禁止EL表达式 
			设置，禁止后会原样输出 <el-ignored>false</el-ignored> 禁止<%%>脚本设置 <scripting-invalid>true</scripting-invalid> 
			抬头 <include-prelude>/prelude.jspf</include-prelude> 结尾 <include-coda>/coda.jspf</include-coda> 
			清除jsp中由于page指令引入带来的空行 <trim-directive-whitespaces>true</trim-directive-whitespaces> 
			</jsp-property-group> -->
	</jsp-config>

	<session-config>
		<session-timeout>30</session-timeout>
		<cookie-config>
			<!-- http-only:true-确保cookie不能被客户端脚本访问 -->
			<http-only>false</http-only>
			<!-- 防止信息泄露，在https中传输启用 -->
			<secure>false</secure>
		</cookie-config>
		<!-- Servlet3.0规范中的<tracking-mode>允许你定义JSESSIONID是存储在cookie中还是URL参数中 -->
		<tracking-mode>COOKIE</tracking-mode>
	</session-config>

	<error-page>
		<error-code>404</error-code>
		<location>/404.html</location>
	</error-page>
	<welcome-file-list>
		<welcome-file>index.html</welcome-file>
		<welcome-file>index.jsp</welcome-file>
	</welcome-file-list>

</web-app>  