I'm testing a web application under different configurations,
some of which involve changing the character encoding in
use. There's a filter that handles calling
HttpServletRequest.setCharacterEncoding appropriately for each
configuration, but in order to handle GET parameters I need to
set the URIEncoding attribute on the Tomcat connector as well. To
avoid restarting Tomcat for each application configuration under
test, I'm using JMX in Ant to change the value of the URIEncoding
attribute for the tests for each configuration. The sequence is
basically

1. Install web application instances by creating appropriate
Context files.

2. Start Tomcat.

3. For each application test configuration, change URIEncoding
using Ant/JMX and run the tests.

My tests of GET parameters are failing when run this way. The
tests pass when I hard-code a value for URIEncoding into
server.xml.

It looks like org.apache.catalina.connector.CoyoteAdapter.service
is able to set the queryStringEncoding property correctly on the
Request's Parameters instance when it creates a new request, but
when it reuses a Request instance it has no way to notice that
the URIEncoding parameter has changed.

Later, in org.apache.catalina.connector.Request.parseParameters,
there's a check for useBodyEncodingForURI which can change the
queryStringEncoding, but there's nothing looking at URIEncoding
there.

I'm not familiar enough with Tomcat's internals to know whether
to check URIEncoding in service or in parseParameters, or how to
resolve a conflict in parseParameters between URIEncoding and
useBodyEncodingForURI, so I don't have a proposed patch.

I ran the test against Tomcat 6.0.16 and saw the same problem; I also checked the Subversion repository for code changes in the areas I was looking at and didn't see any.

For now, I'm going to work around this by changing the way the
tests are run to rewrite server.xml and restart Tomcat between
each configuration, but this is going to be slower. Is there some
other approach I'm missing?

Gennis

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to