Hi,

I did some experiments about more flexible version mapping for contextes
a while back and was a bit unhappy about the type unsafetyness of the
Mapper. Internally it only uses plain Objects and the code using it has
to cast everything.

There is a patch available at

http://people.apache.org/~rjung/patches/mapper-typesafe-trunk.patch

that makes the Mapper type safe. The only changes outside of the mapper
package is the removal of the casts. The TestMapper class had to be
adjusted to use Host, Context and Wrapper objects instead of Strings.

The test suite runs without errors.

One change is potentially problematic: MapperListener previously
registered a new context using the Container returned by
context.getParent(), ignoring whether it is a Host or something else. I
had to cast to Host, because registering a Context for any type of
Container is no longer possible. I doubt that previously it would have
really worked, because all code using the container returned later by
the mapper would have assumed it to be a Host.

The Context interface mentions in comments, that the parent might be
something else than a Host. Does anyone know a good example? Would it
have worked? What would the expected behaviour of MapperListener have
been (where would it have registered that context in the mapper)?

Regards,

Rainer

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to