tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jun Inamori <>
Subject [PROPOSAL]DecodeInterceptor
Date Tue, 23 Apr 2002 12:40:31 GMT

I've played with the new features in Tomcat 3.3.x, specifically with ones related with i18n.
Most of them are the benefits of DecodeInterceptor, the very sophisticated module in Tomcat
Costin, thank you very much for your enthusiastic efforts.

By the way, I have some proposal on DecodeInterceptor.
I've not looked into the source deeply yet, but my understanding at this time is...
In its
    public int postReadRequestMethod(Request)
method, the value of something like:
    <DecodeInterceptor defaultEncoding="ISO-8859-1" />
is applied to the charEncoding both if:
1) charset extension is not found in the Content-Type header.
2) and "charsetURIAttribute" is not set.
As a result, the value of "defaultEncoding" attribute is applied to charEncoding in most cases.
And this charEncoding is also set on the instance of "Request".
As long as the charEncoding is already set on the instance of "Request", "Request" does not
    public Object getInfo(Context,Request,int,String)
of DecodeInterceptor.
    public Object getInfo(Context,Request,int,String)
is wise enough to return the value of something like:
    <Property name="charset" value="Shift_JIS" />
per context, there is no chance for it.

I think this is the design issue and not a bug.
The current design is:
1) Only if "defaultEncoding" attribute is NOT defined in "DecodeInterceptor" element of "server.xml",
the value of "charset" attribute per context will be used.
2) If "defaultEncoding" attribute is defined in "DecodeInterceptor" element of "server.xml",
the value of "charset" attribute per context will be ignored.

We may be more happy if
1) the value of "charset" attribute per context (if exists) can take the precedence over "defaultEncoding"
2) in case that the value of "charset" attribute per context is not defined, "defaultEncoding"
attribute will be used.

To make it possible, the slight modification of
    public int postReadRequestMethod(Request)
will be enough.
It will look like:

	// Context Default 
	if( charEncoding==null ) {
            Context ctx=req.getContext();
	    if( debug > 0 && charEncoding!=null )
		log( "Default per context " + charEncoding );
	// Global Default 
	if( charEncoding==null ) {
	    if( debug > 0 ) log( "Default encoding " + defaultEncoding );
	    if( defaultEncoding != null )

What to you think of this?

Best regards,

Happy Java programming!

Jun Inamori

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message