开发者

customize web application root context in apache

开发者 https://www.devze.com 2023-01-03 21:34 出处:网络
I have web application abc.war and I want to deploy it on Apache Tomcat. The problem is that, by default, the path to this application is http://<server-name>/abc

I have web application abc.war and I want to deploy it on Apache Tomcat. The problem is that, by default, the path to this application is http://<server-name>/abc but I want to access it as http://<server-name>/xyz.

I put into WAR's META-INF folder the file context.xml that is :

<Context path="/xyz" docBase="abc" override="true" />开发者_如何学Python;

The application WAR abc.war is located under %CATALINA_HOME%\webapps and it is extracted to %CATALINA_HOME%\webapps\abc folder.

Also, while deployment, the file context.xml from abc/META-INF is copied to %CATALINA_HOME%\conf\Catalina\localhost as abc.xml

It seems that this should work, but I still can't access my application through http://<server-name>/xyz, but only through http://<server-name>/abc

In addition, I still see in apache log the following line while deployment of abc.war : context path = /abc

Could anybody, please, help while this doesn't work, or tell if there is any way of deploying of web application on apache such that application could be accessed by customized path (that does not relate to war-file name) ?

Thanks in advance.


Take a look at the docs:

The context path of this web application, which is matched against the beginning of each request URI to select the appropriate web application for processing. All of the context paths within a particular Host must be unique. If you specify a context path of an empty string (""), you are defining the default web application for this Host, which will process all requests not assigned to other Contexts.

The value of this field must not be set except when statically defining a Context in server.xml, as it will be inferred from the filenames used for either the .xml context file or the docBase.

0

精彩评论

暂无评论...
验证码 换一张
取 消