tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jun Inamori <>
Subject Re: Proposal: RequestImpl
Date Wed, 03 May 2000 11:52:50 GMT
Hi Costin, Dmitry and Eugen
Thank you for your reply.

I'd like to resume the discussion about my proposal.
We've reached the following conclusion:

1. To get the correct parameter string, we need to know the character
encoding by which the original string was encoded.

2. According to the HTTP spec, such an encoding should be specified by
the 'character-set' attribute of the 'content-type' header. But the WWW
browsers in the real world does not supply this attribute. Due to the
absence of 'character-set' attribute, we need to guess the encoding,
though there are NO effective way to handle all the cases.

3. The practical way to guess the encoding is to determine the first
language in the 'accept-language' values. (Of course, we should at first
check if the 'character-set' attribute of the 'content-type' header is

4. To convert the encoded character stream to the string, I should not
use 'ByteArrayOutputStream', because allocating 'byte[]' again and again
results in the frequent GC and performance issue.

5. It is preferable that decoding is processed by some sort of
'Reader'(which is capable for character encoding), rather than the
individual method in each class. Such a 'Reader', as a independent
class, can also be responsible for other tasks related with character

6. When Servlet2.3 specification available, we may have more
sophisticated way to these problems.

At glance, Costin proposed some attractive way to achieve these tasks in
another posting. It was:
Proposal: afterRead hook, encoding/parsing modularization
According to his proposal, RequestInterceptor.afterRead() is responsible
to trigger decoding and the actual decoding task is done by another
independent class. (This is my recognition.)
Please tell us more detailed about your design, Costin.


Happy Java programming!

Jun Inamori

View raw message