jsonp-java-1.0.0

http://jsonp-java.googlecode.com/

classJsonpFilterimplementsFilter

把随便什么响应包装成jsonpcallback以供js跨域调用

配置例:

<display-name>jsonp</display-name>

<filter-name>jsonp</filter-name>

<filter-class>org.jsonp.JsonpFilter</filter-class>

<init-param>

<param-name>jsonp</param-name>

<param-value>jsonpCallback</param-value>

</init-param>

<init-param>

<param-name>json-mime-types</param-name>

<param-value>application/json</param-value>

</init-param>

</filter>

<filter-mapping>

<filter-name>jsonp</filter-name>

<url-pattern>*</url-pattern>

</filter-mapping>

<mime-mapping>

<extension>json</extension>

<mime-type>application/json</mime-type>

</mime-mapping>

演示应用:

http://jsonp-java.googlecode.com/svn/trunk/src/test/webapp/

相关推荐