spring mvc使用Servlet3异步要注意的几个问题

1、注意添加
<async-supported>true</async-supported>
在web.xml中对DispatcherServlet和所有filter添加<async-supported>true</async-supported>

2、如果集成了shiro一定要注意在mapping中增加dispatcher项,否则会抛出org.apache.shiro.UnavailableSecurityManagerException异常

<filter-mapping>
    <filter-name>shiroFilter</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>ASYNC</dispatcher>
</filter-mapping>


3、如果项目用到了ehcache gzip filter,在异步请求返回时会抛出java.io.IOException: write beyond end of stream异常,解决方案是将gzip filer 换成com.googlecode.webutilities的compressionFilter

猜你喜欢

转载自ismezy.iteye.com/blog/2128704