Bug 52677

Summary: embedded SetCharacterEncodingFilter in org.apache.catalina.filters is not usable as it does not implement javax.servlet.Filter
Product: Tomcat 5 Reporter: Gary Timuss <djhighmass>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal CC: djhighmass, knst.kolinko
Priority: P3    
Version: 5.5.35   
Target Milestone: ---   
Hardware: All   
OS: All   
Attachments: fix for 52677

Description Gary Timuss 2012-02-16 00:57:14 UTC
Version 5.5.35 added SetCharacterEncodingFilter to the org.apache.catalina.filters package so it is available for all web applications. It is documented at http://tomcat.apache.org/tomcat-5.5-doc/config/filter.html#Set_Character_Encoding_Filter

Use of <filter-class>org.apache.catalina.filters.SetCharacterEncodingFilter</filter-class>
however will fail with CastClassException in ApplicationFilterConfig.getFilter:209 as it does not implement javax.servlet.Filter

This problem is not present in the 6.0 branch as SetCharacterEncodingFilter 
implements Filter there

This problem is not present in the 7.0 branch as SetCharacterEncodingFilter extends FilterBase there

Workaround: continue to use your own SetCharacterEncodingFilter that is based on the example in ./servletapi/jsr154/examples/WEB-INF/classes/filters/SetCharacterEncodingFilter.java instead of using the embedded one.
Comment 1 Mark Thomas 2012-02-17 18:26:11 UTC
Fix proposed for 5.5.x
Comment 2 xiaming 2012-02-29 14:42:52 UTC
Created attachment 28406 [details]
fix for 52677
Comment 3 Mark Thomas 2012-03-07 13:19:53 UTC
This has been fixed in 5.5.x and will be included in 5.5.36 onwards.