javatomcat7context.xmlcontextpath

How to set context path in context.xml


I have to deploy my app.war file in tomcat 7. The .war file name is followed by its version no. Here I need to set up a context path, so that the actual url will contain only the app name(without version no).

My requirement is that, there should be no edit in server.xml.

My context.xml is as follows.

<?xml version='1.0' encoding='utf-8'?>
<Context path="/app" docBase="app-1.0" debug="0" reloadable="true">

    <!-- Defines links to JNDI Data Sources -->
    <!-- Thus the server determines database connection. -->

    <ResourceLink
            name="..."
            global="..."
            auth="Container" type="javax.sql.DataSource"/>

    .....
    .....

</Context>

The context.xml is placed inside the war at /META-INF folder. Can anyone tell me where am i wrong.


Solution

  • All the elements are in the docs : http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Naming

    For your use case, you could do try :