Hi,

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 3.3.x.
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 call
    public Object getInfo(Context,Request,int,String)
of DecodeInterceptor.
While
    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" attribute.
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();
            charEncoding=ctx.getProperty("charset");
            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 )
                charEncoding=defaultEncoding;
        }

What to you think of this?

Best regards,
-- 

Happy Java programming!

Jun Inamori
OOP-Reserch
E-mail: [EMAIL PROTECTED]
URL:    http://www.oop-reserch.com/

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to