Hi :-) I did a test with TC4.0-b5(standalone, J2SE1.3, winnt40):
* cases:
-
% put the Same MyServlet.class in WEB-INF/classes in
Different "Context path" which has Different "Context docBase"
% put the Same MyServlet.class in the Same MyJar.jar file in
WEB-INF/lib in
Different "Context path" which has Different "Context docBase"
% put the Same MyUtility.class in WEB-INF/classes in
Different "Context path" which has Different "Context docBase"
% put the Same MyUtility.class in the Same MyJar.jar file in
WEB-INF/lib in
Different "Context path" which has Different "Context docBase"
-
% put the Same MyServlet.class in WEB-INF/classes in
Different "Context path" which has Same "Context docBase"
% put the Same MyServlet.class in the Same MyJar.jar file in
WEB-INF/lib in
Different "Context path" which has Same "Context docBase"
% put the Same MyUtility.class in WEB-INF/classes in
Different "Context path" which has Same "Context docBase"
% put the Same MyUtility.class in the Same MyJar.jar file in
WEB-INF/lib in
Different "Context path" which has Same "Context docBase"
* in all the above cases, all MyServlet/MyUtility of different
"Context path"(NOT "Context docBase") are different in the
follwing way:
- classloader: this.getClass().getClassLoader().hashCode()
- Class object: this.getClass().hashCode()
(so/then), I can seprate all the "public static field" in
MyServlet/MyUtility by
different "Context path"(NOT "Context docBase"), i.e. :
% I can set "it is 0" to a "public static String field"->MyField
in MyServlet/MyUtility
of "Context path0", and use it within "Context path0"
% I can set "it is 1" to a "public static String field"->MyField
in MyServlet/MyUtility
of "Context path1", and use it within "Context path1"
- i.e., "Context path"/webappClassLoader/"Class object"/"static
field"
is "independent" to the following:
% "Context docBase"
% .class file/.jar file
and please notice that jar file in WEB-INF/lib can not be auto-reloaded,
so if you
update a jar file in WEB-INF/lib, you need to re-start TC4.0-b5.
Bo
June 13, 2001