org.apache.catalina.startup.Tomcat creates contexts and add them to the host directly. It would be nice if we could set the name of the context before adding it to the host. I'm including a patch that overloads the methods "addWebapp" and "addContext" to take that name as a parameter.
Created attachment 26942 [details] patch that fix this issue
Providing a patch that doesn't compile (two missing returns and contextName != name) doesn't help the chances that the patch will ever be applied. In this case the fixes were simple and the patch is useful so the issue were fixed and the patch has been applied. However, be aware that this is the exception rather than the rule and that typically, poor quality patches will be rejected. The new methods will be in 7.0.13 onwards.