pom 中引入:


		<dependency>
			<groupId>org.ebaysf.web</groupId>
			<artifactId>cors-filter</artifactId>
			<version>1.0.1</version>
		</dependency>

工程web.xml 中增加 过滤器

<filter>
		<filter-name>CORS Filter</filter-name>
		<filter-class>org.ebaysf.web.cors.CORSFilter</filter-class>
		<init-param>
			<param-name>cors.allowed.origins</param-name>
			<param-value>*</param-value>
		</init-param>
		<init-param>
			<param-name>cors.allowed.methods</param-name>
			<param-value>GET,POST,HEAD,OPTIONS,PUT</param-value>
		</init-param>
		<init-param>
			<param-name>cors.allowed.headers</param-name>
			<param-value>Content-Type,X-Requested-With,accept,Origin,Access-Control-Request-Method,Access-Control-Request-Headers</param-value>
		</init-param>
	</filter>
	<filter-mapping>
		<filter-name>CORS Filter</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>