You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by lightbulb432 <ve...@hotmail.com> on 2007/12/10 03:10:16 UTC

Specify context path when context.xml is in META-INF

Is there a way, when you have your context.xml in META-INF rather than
specifying the Context element in server.xml or elsewhere, to customize the
context path?

I'd like to use context.xml in META-INF because of the benefits of this
approach, but there seems to be no way to change the context path, which is
always the name of the folder underneath appBase. For example, if appBase
contains a folder called webroot, then the context will be called webroot.
(It's not possible to change the name of this folder for some internal
reasons.)

The documentation seems to indicate that a path attribute cannot be present
in the Context element when context.xml is in META-INF - is there another
way to achieve the effect I've described? If not, is there a strong reason
why context.xml in META-INF couldn't read and use the path attribute of
Context?

Thanks.
-- 
View this message in context: http://www.nabble.com/Specify-context-path-when-context.xml-is-in-META-INF-tp14246199p14246199.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


RE: Specify context path when context.xml is in META-INF

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: lightbulb432 [mailto:veerukrishnan@hotmail.com] 
> Subject: RE: Specify context path when context.xml is in META-INF
> 
> Based on what I've read, I've learned that the least ideal 
> approach is to place the context information in server.xml.

Correct; doing so requires a Tomcat restart to change anything, and goes
against the servlet spec premise of webapps being self-contained.

> What are the tradeoffs (apart from the path naming issue)
> of placing context.xml in META-INF versus as 
> conf/Catalina/[host]/[appname].xml?

If the webapp requires no customization for each deployment, then
keeping the <Context> element in META-INF/context.xml has the distinct
advantage of having only one entity (the .war file) to deal with.
However, if customization is required, then distributing the <Context>
element separately for placement in conf/Catalina/[host]/[appname].xml
makes it easier on the sysadmin.  The latter approach avoids having to
take the .war file apart manually, update the <Context>, and put it back
together.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

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


RE: Specify context path when context.xml is in META-INF

Posted by lightbulb432 <ve...@hotmail.com>.
Based on what I've read, I've learned that the least ideal approach is to
place the context information in server.xml.

What I don't know, though, is how the remaining options stack up to each
other. What are the tradeoffs (apart from the path naming issue) of placing
context.xml in META-INF versus as conf/Catalina/[host]/[appname].xml? For
what reasons is one approach better than the other?

I don't have as much experience deploying to Tomcat as some of you might, so
I'm hoping you could outline the advantages and disadvantages of either
approach.



Caldarale, Charles R wrote:
> 
>> From: lightbulb432 [mailto:veerukrishnan@hotmail.com] 
>> Subject: Specify context path when context.xml is in META-INF
>> 
>> Is there a way, when you have your context.xml in META-INF rather than
>> specifying the Context element in server.xml or elsewhere, to 
>> customize the context path?
> 
> No - the path is taken from the name of the .war file or directory.  The
> only way to accomplish what you want is to place the <Context> element
> in the conf/Catalina/[host]/[appname].xml location, in which case the
> [appname] is the path.  The application should not be placed in the
> <Host> appBase in this case, or you risk double deployment.
> 
>> If not, is there a strong reason why context.xml in META-INF
>> couldn't read and use the path attribute of Context?
> 
> Primarily to avoid ambiguities and extra, unwanted deployments.
> 
>  - Chuck
> 
> 
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> MATERIAL and is thus for use only by the intended recipient. If you
> received this in error, please contact the sender and delete the e-mail
> and its attachments from all computers.
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Specify-context-path-when-context.xml-is-in-META-INF-tp14246199p14246383.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


RE: Specify context path when context.xml is in META-INF

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: lightbulb432 [mailto:veerukrishnan@hotmail.com] 
> Subject: Specify context path when context.xml is in META-INF
> 
> Is there a way, when you have your context.xml in META-INF rather than
> specifying the Context element in server.xml or elsewhere, to 
> customize the context path?

No - the path is taken from the name of the .war file or directory.  The
only way to accomplish what you want is to place the <Context> element
in the conf/Catalina/[host]/[appname].xml location, in which case the
[appname] is the path.  The application should not be placed in the
<Host> appBase in this case, or you risk double deployment.

> If not, is there a strong reason why context.xml in META-INF
> couldn't read and use the path attribute of Context?

Primarily to avoid ambiguities and extra, unwanted deployments.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

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