<?xml version="1.0" encoding="UTF-8"?>
<web-app>

	<!-- 1.icon -->
	<icon></icon>

	<!-- 2.display-name 定义站台的名称 -->
	<display-name></display-name>

	<!-- 3.description 是对站台的描述 -->
	<description></description>

	<!-- 4.context-param 用来设定web站台的环境参数 -->
	<!--contextConfigLocation在 ContextLoaderListener类中的默认值是 /WEB-INF/applicationContext.xml -->
	<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>/WEB-INF/applicationContext.xml</param-value>
		<!-- <param-value>classpath:applicationContext*.xml</param-value> -->
	</context-param>



	<!-- 5.filter -->
	<filter>
		<filter-name>struts2</filter-name>
		<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
		</filter-class>
	</filter>
	
	<!-- 拆分StrutsPrepareAndExecuteFilter,在中间加入自定义过滤器,然后在filter-mapping加入过滤器映射-->
	<filter>
		<filter-name>StrutsPrepareFilter</filter-name>
		<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter
		</filter-class>
	</filter>
	<!-- 自定义的过滤器 
	<filter>
		<filter-name>SelfCustomFilter</filter-name>
		<filter-class>com.filter.PageFilter
		</filter-class>
	</filter> -->
	<filter>
		<filter-name>StrutsExecuteFilter</filter-name>
		<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter
		</filter-class>
	</filter>

	<!-- 6.filter-mapping -->
	<!-- 配置Filter拦截的URL -->
	<filter-mapping>
		<!-- 配置Struts2的核心FilterDispatcher拦截所有用户请求 -->
		<filter-name>struts2</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>


	<!-- 7.listener -->
	<!--Spring的ApplicationContext 载入 -->
	<listener>
		<listener-class>org.springframework.web.context.ContextLoaderListener
		</listener-class>
	</listener>

	<!-- Spring 刷新Introspector防止内存泄露 -->
	<listener>
		<listener-class>org.springframework.web.util.IntrospectorCleanupListener
		</listener-class>
	</listener>



	<!-- 8.servlet 用来声明一个servlet的数据 -->
	<servlet>
		<servlet-name>dwr-invoker</servlet-name>
		<display-name>DWR Servlet</display-name>
		<description>Direct Web Remoter Servlet</description>
		<servlet-class>uk.ltd.getahead.dwr.DWRServlet</servlet-class>
		<init-param>
			<param-name>debug</param-name>
			<param-value>true</param-value>
		</init-param>
	</servlet>

	<!-- 9.servlet-mapping -->
	<servlet-mapping>
		<servlet-name>dwr-invoker</servlet-name>
		<url-pattern>/dwr/*</url-pattern>
	</servlet-mapping>


	<!-- 10.session-config 用来定义web站台中的session参数 -->
	<session-config>
		<session-timeout>30</session-timeout>
	</session-config>

	<!-- 11.mime-mapping -->
	<mime-mapping>
		<extension>doc</extension>
		<mime-type>application/vnd.ms-word</mime-type>
	</mime-mapping>
	<mime-mapping>
		<extension>xls</extension>
		<mime-type>application/vnd.ms-excel</mime-type>
	</mime-mapping>


	<!-- 12.welcome-file-list 用来定义首页的列单 -->
	<welcome-file-list>
		<welcome-file>index.jsp</welcome-file>
		<welcome-file>index.html</welcome-file>
	</welcome-file-list>

	<!-- 13.error-page -->
	<error-page>
		<error-code>404</error-code>
		<location>/error404.jsp</location>
	</error-page>
	<error-page>
		<exception-type>java.lang.Exception</exception-type>
		<location>/exception.jsp</location>
	</error-page>

	<!-- 14.jsp-config -->
	<jsp-config></jsp-config>

	<!-- 15.resource-env-ref -->
	<resource-env-ref>
		<resource-env-ref-name>jdbc/mssql</resource-env-ref-name>
		<resource-env-ref-type>javax.sql.DataSource</resource-env-ref-type>
	</resource-env-ref>


	<!-- 16.resource-ref -->
	<resource-ref>
		<description>JNDI JDBC DataSource</description>
		<res-ref-name>jdbc/data</res-ref-name>
		<res-type>javax.sql.DataSoruce</res-type>
		<res-auth>Container</res-auth>
	</resource-ref>


	<!-- 17.security-constraint -->
	<security-constraint>
		<display-name>Example Security Constraint</display-name>
		<web-resource-collection>
			<web-resource-name>Protected Area</web-resource-name>
			<url-pattern>/jsp/security/protected/*</url-pattern>
			<http-method>DELETE</http-method>
			<http-method>GET</http-method>
			<http-method>POST</http-method>
			<http-method>PUT</http-method>
		</web-resource-collection>
		<auth-constraint>
			<role-name>tomcat</role-name>
			<role-name>role1</role-name>
		</auth-constraint>
	</security-constraint>

	<!-- 18.login-config -->
	<login-config>
		<auth-method>FORM</auth-method>
		<realm-name>Example-Based Authentiation Area</realm-name>
		<form-login-config>
			<form-login-page>/jsp/security/protected/login.jsp</form-login-page>
			<form-error-page>/jsp/security/protected/error.jsp</form-error-page>
		</form-login-config>
	</login-config>

	<!-- 19.security-role -->
	<security-role>
		<role-name>tomcat</role-name>
	</security-role>

	<!-- 20.env-entry -->
	<env-entry>
		<env-entry-name>minExemptions</env-entry-name>
		<env-entry-value>1</env-entry-value>
		<env-entry-type>java.lang.Integer</env-entry-type>
	</env-entry>

	<!-- 21.ejb-ref -->
	<ejb-ref>
		<description>Example EJB reference</description>
		<ejb-ref-name>ejb/Account</ejb-ref-name>
		<ejb-ref-type>Entity</ejb-ref-type>
		<home>com.mycompany.mypackage.AccountHome</home>
		<remote>com.mycompany.mypackage.Account</remote>
	</ejb-ref>

	<!-- 22.ejb-local-ref -->
	<ejb-local-ref>
		<description>Example Loacal EJB reference</description>
		<ejb-ref-name>ejb/ProcessOrder</ejb-ref-name>
		<ejb-ref-type>Session</ejb-ref-type>
		<local-home>com.mycompany.mypackage.ProcessOrderHome</local-home>
		<local>com.mycompany.mypackage.ProcessOrder</local>
	</ejb-local-ref>









</web-app>