Bug 52677 - embedded SetCharacterEncodingFilter in org.apache.catalina.filters is not usable as it does not implement javax.servlet.Filter
Summary: embedded SetCharacterEncodingFilter in org.apache.catalina.filters is not usa...
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 5
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 5.5.35
Hardware: All All
: P3 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-16 00:57 UTC by Gary Timuss
Modified: 2012-03-07 13:19 UTC (History)
2 users (show)



Attachments
fix for 52677 (1.11 KB, patch)
2012-02-29 14:42 UTC, xiaming
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.