<web-app xmlns="http://java.sun.com/xml/ns/javaee" 
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
	version="3.0" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee ./xsd/web-app_3_0.xsd">

	<listener>
		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
	</listener>

	<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>
			classpath:hapi-fhir-server-resourceproviders-dstu1.xml
			classpath:hapi-fhir-server-resourceproviders-dstu2.xml
			/WEB-INF/hapi-fhir-server-database-config.xml
			/WEB-INF/hapi-fhir-server-config.xml
			/WEB-INF/hapi-fhir-tester-application-context.xml
			/WEB-INF/hapi-fhir-tester-config.xml
		</param-value>
	</context-param>

  <!-- Servlets -->

	<servlet>
		<servlet-name>spring</servlet-name>
		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
		<init-param>
			<param-name>contextConfigLocation</param-name>
			<param-value>
				/WEB-INF/hapi-fhir-tester-application-context.xml
				/WEB-INF/hapi-fhir-tester-config.xml
			</param-value>
		</init-param>
		<load-on-startup>2</load-on-startup>
	</servlet>

	<servlet>
		<servlet-name>fhirServlet</servlet-name>
		<servlet-class>ca.uhn.fhir.jpa.demo.JpaServerDemo</servlet-class>
		<init-param>
			<param-name>ImplementationDescription</param-name>
			<param-value>FHIR JPA Server</param-value>
		</init-param>
		<init-param>
			<param-name>FhirVersion</param-name>
			<param-value>DSTU1</param-value>
		</init-param>
		<load-on-startup>1</load-on-startup>
	</servlet>

	<servlet-mapping>
		<servlet-name>fhirServlet</servlet-name>
		<url-pattern>/base/*</url-pattern>
	</servlet-mapping>

	<servlet-mapping>
		<servlet-name>spring</servlet-name>
		<url-pattern>/</url-pattern>
	</servlet-mapping>
	


	<!-- This filters provide support for Cross Origin Resource Sharing (CORS) -->
	<filter>
		<filter-name>CORS Filter</filter-name>
		<filter-class>org.ebaysf.web.cors.CORSFilter</filter-class>
		<init-param>
			<description>A comma separated list of allowed origins. Note: An '*' cannot be used for an allowed origin when using credentials.</description>
			<param-name>cors.allowed.origins</param-name>
			<param-value>*</param-value>
		</init-param>
		<init-param>
			<description>A comma separated list of HTTP verbs, using which a CORS request can be made.</description>
			<param-name>cors.allowed.methods</param-name>
			<param-value>GET,POST,PUT,DELETE,OPTIONS</param-value>
		</init-param>
		<init-param>
			<description>A comma separated list of allowed headers when making a non simple CORS request.</description>
			<param-name>cors.allowed.headers</param-name>
			<param-value>X-FHIR-Starter,Origin,Accept,X-Requested-With,Content-Type,Access-Control-Request-Method,Access-Control-Request-Headers</param-value>
		</init-param>
		<init-param>
			<description>A comma separated list non-standard response headers that will be exposed to XHR2 object.</description>
			<param-name>cors.exposed.headers</param-name>
			<param-value>Location,Content-Location</param-value>
		</init-param>
		<init-param>
			<description>A flag that suggests if CORS is supported with cookies</description>
			<param-name>cors.support.credentials</param-name>
			<param-value>true</param-value>
		</init-param>
		<init-param>
			<description>A flag to control logging</description>
			<param-name>cors.logging.enabled</param-name>
			<param-value>true</param-value>
		</init-param>
		<init-param>
			<description>Indicates how long (in seconds) the results of a preflight request can be cached in a preflight result cache.</description>
			<param-name>cors.preflight.maxage</param-name>
			<param-value>300</param-value>
		</init-param>
	</filter>
	<filter-mapping>
		<filter-name>CORS Filter</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>


</web-app>
