Bug 51136

Summary: Allow to set the context name through Tomcat's embeded class before adding it to the host
Product: Tomcat 7 Reporter: David Calavera <david.calavera>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: enhancement    
Priority: P2    
Version: trunk   
Target Milestone: ---   
Hardware: PC   
OS: All   
Attachments: patch that fix this issue

Description David Calavera 2011-04-29 16:18:31 UTC
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.
Comment 1 David Calavera 2011-04-29 16:19:10 UTC
Created attachment 26942 [details]
patch that fix this issue
Comment 2 Mark Thomas 2011-05-04 08:48:11 UTC
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.