简体   繁体   English

如何在Eclipse WTP Tomcat中自动设置crossContext

[英]How to auto set crossContext in an Eclipse WTP Tomcat

How can I set the crossContext directive in the context of an web application so any WTP publish / deploy will set this correct to the generated Applications context.xml (conf/Catalina/localhost/appname.xml) 如何在Web应用程序的上下文中设置crossContext指令,以便任何WTP发布/部署都会将此正确设置为生成的Applications context.xml(conf / Catalina / localhost / appname.xml)

I tried to set it in the Servers context.xml as "default" but also generated a stub context.xml in the WEB-INF/context.xml of the web application, but nothing seems to help here ;/ 我试图在Servers context.xml中将其设置为“ default”,但还在Web应用程序的WEB-INF / context.xml中生成了一个存根context.xml,但是似乎没有什么帮助; //

The WEB-INF/context.xml: WEB-INF / context.xml:

<?xml version="1.0" encoding="UTF-8"?>
<Context crossContext="true">
</Context>

Notes: 笔记:

related to How to get a tomcat project path from different project in same tomcat by using java 有关如何使用java从同一tomcat中的不同项目获取tomcat项目路径的信息

It's simple but not perfect: 很简单,但并不完美:

  1. After adding the module to tomcat via wtp, open the WTP Tomcat server.xml (typically located in your workspace > Servers > Tomcat vX.X Server at localhost ) and add attribute crossContext="true" to the <Context> tag of the corresponding web-module. 通过wtp将模块添加到tomcat之后,打开WTP Tomcat server.xml(通常位于workspace > Servers > Tomcat vX.X Server at localhost ),然后将属性crossContext="true"到相应的<Context>标记中网络模块。
  2. check "Publish module contexts to seperate XML files" in Tomcat WTP Frontend 在Tomcat WTP前端中检查“发布模块上下文以分离XML文件”

Positive side-effects: This will survive any "clean Tomcats working directory" or "clean project" actions 积极的副作用:任何“干净的Tomcats工作目录”或“干净的项目”操作都将保留下来

(still) Negative: This will be overridden / removed if you change any WTP Tomcat options that affects server.xml like adding new modules, changing ports... After this action, you have to add it again. (仍然)否定的:如果您更改任何会影响server.xml的WTP Tomcat选项(例如添加新模块,更改端口... ),则将覆盖/删除此操作之后,您必须再次添加它。 There is still NO frontend option as like for reloadable or ContextPath ;/ 仍然没有像reloadableContextPath这样的前端选项; /

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM