<?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" 
	xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
	id="WebApp_ID" version="2.5">
	
	<display-name>CentricityPracticeWS</display-name>

	
	<!-- init properties shared by entire application -->
	<context-param>
		<param-name>earDeploymentDescriptorPath</param-name>
		<param-value>application.xml</param-value>
	</context-param>
	<listener>
		<listener-class>com.gehcit.cp.ws.infrastructure.configuration.ConfigurationLoaderListener</listener-class>
	</listener>
	
	<!-- bootstrap Log4j -->
	<!-- Log4j refresh interval -->
	<context-param>
		<param-name>log4jRefreshInterval</param-name>
		<param-value>60000</param-value>
	</context-param>
	<context-param>
		<param-name>log4jExposeWebAppRoot</param-name>
		<param-value>false</param-value>
	</context-param>
	<listener>
		<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
	</listener>
	
	<!-- bootstrap Spring -->
	<context-param>
		<param-name>parentContextKey</param-name>
		<param-value>centricity.practice</param-value>
	</context-param>
	<context-param>
		<param-name>locatorFactorySelector</param-name>
		<param-value>/beanRefFactory.xml</param-value>
	</context-param> 
	<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>/WEB-INF/context-web.xml</param-value>
	</context-param>
	<listener>
		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
	</listener>
	
	<!-- log appropriate configuration for support -->
	<listener>
		<listener-class>com.gehcit.cp.ws.infrastructure.configuration.ConfigurationLoggerListener</listener-class>
	</listener>
	
	<!-- session listener invoker -->
	<listener>
		<listener-class>com.gehcit.cp.ws.infrastructure.session.SessionListenerInvoker</listener-class>
	</listener>
	
	<!-- CommonEventModel Listener invoker -->
	<listener>
		<listener-class>com.gehcit.cp.cem.CommonEventModelListener</listener-class>
	</listener>
	
	<!-- InitializeCacheListener invoker -->
	<listener>
		<listener-class>com.gehcit.cp.infrastructure.caching.listener.InitializeCacheListener</listener-class>
	</listener> 
	
	<!-- Spring based filter chain for SOAP services -->
	<filter>
		<display-name>soapServicesFilterChain</display-name>
		<filter-name>soapServicesFilterChain</filter-name>
		<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
	</filter>
	<filter-mapping>
		<filter-name>soapServicesFilterChain</filter-name>
		<url-pattern>/Services/*</url-pattern>
		<dispatcher>REQUEST</dispatcher>
	</filter-mapping>

	<!-- Spring based security filter chain for RESTful services -->
	<filter>
		<display-name>springSecurityFilterChain</display-name>
		<filter-name>springSecurityFilterChain</filter-name>
		<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
	</filter>
	<filter-mapping>
		<filter-name>springSecurityFilterChain</filter-name>
		<url-pattern>/Services/rs/*</url-pattern>
		<dispatcher>REQUEST</dispatcher>
	</filter-mapping>

	<!-- log4j MDC filter -->
	<filter>
		<display-name>Log4jMDCFilter</display-name>
		<filter-name>Log4jMDCFilter</filter-name>
		<filter-class>com.gehcit.cp.ws.infrastructure.logging.Log4jMDCFilter</filter-class>
		<init-param>
			<description>MDC key name for the request ID</description>
			<param-name>requestIdKey</param-name>
			<param-value>requestId</param-value>
		</init-param>
		<init-param>
			<description>MDC key name for the principal</description>
			<param-name>principalKey</param-name>
			<param-value>principal</param-value>
		</init-param>
		<init-param>
			<description>The principal name to use when a principal cannot be found</description>
			<param-name>unknownPrincipalName</param-name>
			<param-value>UNKNOWN</param-value>
		</init-param>
	</filter>
	<filter-mapping>
		<filter-name>Log4jMDCFilter</filter-name>
		<servlet-name>CXFServlet</servlet-name>
		<dispatcher>REQUEST</dispatcher>
	</filter-mapping>
	
	<!-- Expiration time in second. Current value is one month (30*24*60*60=2592000)-->
	<filter>
		<filter-name>staticContentCache</filter-name>
		<filter-class>com.samaxes.filter.CacheFilter</filter-class>
		<init-param>
			<param-name>expiration</param-name>
			<param-value>2592000</param-value>
		</init-param>
		<init-param>
			<param-name>must-revalidate</param-name>
			<param-value>true</param-value>
		</init-param>		
	</filter>
	
	<filter-mapping>
		<filter-name>staticContentCache</filter-name>
		<url-pattern>*.png</url-pattern>
	</filter-mapping>
	<filter-mapping>
		<filter-name>staticContentCache</filter-name>
		<url-pattern>*.jpg</url-pattern>
	</filter-mapping>
	<filter-mapping>
		<filter-name>staticContentCache</filter-name>
		<url-pattern>*.css</url-pattern>
	</filter-mapping>

	<filter-mapping>
		<filter-name>staticContentCache</filter-name>
		<url-pattern>*.js</url-pattern>
	</filter-mapping>
	<filter-mapping>
		<filter-name>staticContentCache</filter-name>
		<url-pattern>*.html</url-pattern>
	</filter-mapping>
	
	<!-- cxf servlet-->
	<servlet>
        <servlet-name>CXFServlet</servlet-name>
        <servlet-class>
            org.apache.cxf.transport.servlet.CXFServlet
        </servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>CXFServlet</servlet-name>
        <url-pattern>/Services/*</url-pattern>
    </servlet-mapping>

	<!-- REFACTOR OUT OF APP -->
    <servlet>
        <servlet-name>StartupServlet</servlet-name>
        <servlet-class>com.gehcit.cp.core.startup.StartupServlet</servlet-class>
        <load-on-startup>2</load-on-startup>
    </servlet>
	
	<!-- welcome file list-->
    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
    </welcome-file-list>
    
    <!-- To support application cache HTML5 flag ship feature, appcache mime-type is required. The cache manifest is the file that indicates to the browser which folders or files to cache. The browser will only
         update the cached files (retrieving them from the server) when the cache manifest is modified.-->
	<mime-mapping>
        <extension>appcache</extension>
        <mime-type>text/cache-manifest</mime-type>
    </mime-mapping>
	
</web-app>
