使用的是cas-client-3.2.1,在web.xml中加上单点退出。
<filter> <filter-name>CAS Single Sign Out Filter</filter-name> <filter-class>org.jasig.cas.client.session.SingleSignOutFilter</filter-class> </filter> <filter-mapping> <filter-name>CAS Single Sign Out Filter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <listener> <listener-class>org.jasig.cas.client.session.SingleSignOutHttpSessionListener</listener-class> </listener>
发现表单提交,写入DB乱码了。 去掉就OK,相信是单点退出的问题。
一顿搜索后,证实了此问题。 -------------------------------------------- 大概原因是:
SingleSignOutFilter 里从request取参数了,从而引起了对request内容的解析,
而又没有指定request的编码,此处错误,后面再转也没用了。
--------------------------------------------- 见此文: https://wiki.jasig.org/display/CASC/Configuring+Single+Sign+Out
http://jira.grails.org/browse/GPSPRINGSECURITYCAS-5?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel
SingleSignOutFilter影响字符编码,推荐显式的配置一下编码, 可以使用VT Character Encoding Filter或者Spring Character Encoding Filter。
而且,很重要的一点,编码Filter需要放在最前面,也就是在单点退出Filter之前。
<filter> <filter-name>characterEncodingFilter</filter-name> <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> </filter> <filter-mapping> <filter-name>characterEncodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
<filter> <filter-name>CAS Single Sign Out Filter</filter-name> <filter-class>org.jasig.cas.client.session.SingleSignOutFilter</filter-class> </filter> <filter-mapping> <filter-name>CAS Single Sign Out Filter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <listener> <listener-class>org.jasig.cas.client.session.SingleSignOutHttpSessionListener</listener-class> </listener>
--------------------------- Filter貌似只影响POST的数据,Get的数据还是要改tomcat的server.xml啦~~ <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8" useBodyEncodingForURI="true"/> 加两个UTF8那个~~
|