[英]how to set context path in context.xml for java application
When i am creating context path in server.xml of tomcat server then everything is working fine. 当我在tomcat服务器的server.xml中创建上下文路径时,一切工作正常。 But I want to write context element in context.xml to define different URL to same application then it is not working.
但是我想在context.xml中编写context元素来为同一应用程序定义不同的URL,然后它不起作用。 Please explain how to modify context.xml to read the path from context.xml.
请说明如何修改context.xml以从context.xml读取路径。 like :
喜欢 :
<Context path="/vk" docBase="E:\java\MyProject\apache-tomcat-7.0.19\webapps\test" reloadable="true" />
Tomcat takes the context path from the name of the war file (or directory under webapps). Tomcat从war文件(或webapps下的目录)的名称获取上下文路径。 If you want to deploy your app as
/vk
then name it vk.war
, or /foo/bar
name it foo#bar.war
如果要将应用程序部署为
/vk
则将其命名为vk.war
,或将/foo/bar
命名为foo#bar.war
To deploy the same app at two different paths, put it outside the webapps dir, then create context definition files in conf/Catalina/localhost
named test.xml
, vk.xml
etc. you don't need a path
attribute, again the context path is deduced from the name of the file. 要在两个不同的路径上部署相同的应用程序,请将其放置在webapps目录之外 ,然后在
conf/Catalina/localhost
名为test.xml
, vk.xml
等的上下文定义文件。您不需要path
属性,也不需要上下文从文件名推导出路径。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.