Can a Tomcat docBase span multiple folders?--转
Question:
I apologize if this is a poor question, but I'm using Windows and looking to see if there's a way to run a webapp via Tomcat where the docBase
is multiple folders.
A little more background is that we have our Eclipse project set up in a way that the web content is broken into separate folders. One folder represents what our SDK provides, one is a folder which has SDK patches, and a third is the project-specific components -- either of the last two folders could have subfolders/files that "erase" items from the first two.
I'd like to try and have my context file point back into my dev environment so that I don't need to build/deploy in order to see the changes I'm making. Is this possible?
A couple other notes:
- We thought about using symlinks via
mklink
, but didn't want to create complexity if simplicity was out there. - This is just for running locally so simple hacks would be allowed. When we create the WAR which gets deployed to the real environment the ANT script creates a single web root.
Answer 1:
I use it this way:
<Context docBase="jquery" path="/js/jquery" />
<Context docBase="foobar/www/javascript" path="/js" />
<Context docBase="foobar/www/css" path="/css" />
<Context docBase="foobar" path="/" />
Important for the concrete context is the path-attribute. A request is processed from top to bottom.
So a request for /css/default.css
is only processed from the 3rd context.
A different order may catches a different context.
This is wrong:
<Context docBase="foobar" path="/" />
<Context docBase="jquery" path="/js/jquery" />
<Context docBase="foobar/www/javascript" path="/js" />
<Context docBase="foobar/www/css" path="/css" />
Because /css/default.css
will be catched by the first context, not the fourth.
Edit 2013-08-10: (Not by the answer-author) It is important to note that while the above technique will work, much of it is actually incorrect. Please see comments for details.
Answer 2:
Tomcat can do this for you, you just need a little extra configuration.
You are looking for VirtualDirContext which allows you to specify a list of extraResourcePaths
which will be searched (in order) for additional files. You can use that to merge static resources, JSPs, directories of JAR files, etc.
Just remember that each path you add makes every file lookup potentially take longer -- especially if the file can't be found at all.
原文:http://stackoverflow.com/questions/17738049/can-a-tomcat-docbase-span-multiple-folders/17861223#17861223
Can a Tomcat docBase span multiple folders?--转的更多相关文章
- Could not publish server configuration for MyEclipse Tomcat v7.0. Multiple Contexts have a path
Could not publish server configuration for Tomcat v6.0 Server at localhost. 经常在使用tomcat服务器的时候 总会发生一些 ...
- tomcat docBase 和 path
<Context docBase="zjzc-web-api" path="/api" reloadable="false"/> ...
- 【Tomcat】Tomcat的使用
第一章 JDK的安装 1.1 windows下安装 1.1.1 配置环境变量 安装完成后,还要进行 Java 环境的配置,才能正常使用,步骤如下: (1)在我的电脑点击右键——〉选择属性, (2) ...
- Tomcat Clustering - A Step By Step Guide --转载
Tomcat Clustering - A Step By Step Guide Apache Tomcat is a great performer on its own, but if you'r ...
- nginx+tomcat+memcached搭建服务器集群及负载均衡
在实际项目中,由于用户的访问量很大的原因,往往需要同时开启多个服务器才能满足实际需求.但是同时开启多个服务又该怎么管理他们呢?怎样实现session共享呢?下面就来讲一讲如何使用tomcat+ngin ...
- eclipse发布项目报错:Multiple Contexts hava a path of “/xxx“
你的位置:首页 > Java编程 > eclipse发布项目报错:Multiple Contexts hava a path of “/xxx“ eclipse发布项目报错:Multipl ...
- Nginx 与Tomcat 实现动静态分离、负载均衡
Nginx 与Tomcat 实现动静态分离.负载均衡 一.Nginx简介: Nginx一个高性能的HTTP和反向代理服务器, 具有很高的稳定性和支持热部署.模块扩展也很容易.当遇到访问的峰值,或者有人 ...
- Nginx+Tomcat+Memcached 实现集群部署时Session共享
Nginx+Tomcat+Memcached 实现集群部署时Session共享 一.简介 我们系统经常要保存用户登录信息,有Cookie和Session机制,Cookie客户端保存用户信息,Sessi ...
- GridLayout with span
Widgets can span multiple columns or rows in a grid. In the next example we illustrate this. #!/usr/ ...
随机推荐
- 六、C# 派生
派生 对一个现有的类型进行扩展,以便添加更多的功能,或者对现有的类型的操作进行重写. 比如可以将两个类都适用的方法和属性,用一个新的类进行重构,两个类再分别继承这个类. 定义一个派生类时,要在 ...
- IOS 真机调试以及发布应用 2
参考网站:http://my.oschina.net/u/1245365/blog/196420 已经有开发证书的直接跳过第一步 第一步:申请“开发证书” 进入苹果开发者99美元账号: 选择:Cert ...
- UITextField AutoComplete iOS输入框内文本自动完成
当你打开Safari的时候,输入网址,会有许多候选网址,点击后,自动填充到输入框,进入网页. 打开词典查单词的时候,输入前面部分字母,软件会给出符合的候选单词. 这样做的目的,是为了省去用户繁琐的输入 ...
- element的height与width
关于一个element所有的高度宽度 ele.style.width,ele.style.height:操纵style样式.+"px" offsetWidth.offsetHeig ...
- jquery-object.js
/** * jQuery.query - Query String Modification and Creation for jQuery * Written by Blair Mitchelmor ...
- Excel--java POi
import java.io.File; import java.io.FileOutputStream; import org.apache.commons.io.FileUtils; import ...
- Java中抽象类和接口的用法和区别
一.抽象类 1.抽象类 包含一个抽象方法的类就是抽象类 2.抽象方法 声明而未被实现的方法,抽象方法必须使用abstract关键词字声明 public abstract class People { ...
- UGUI穿透3D世界判断&&UGUI全事件监听
public bool isPointUI(){ PointerEventData eventDataCurrnt = new PointerEventData (EventSystem.curren ...
- Json 处理datetime
json怎么处理datetime类型 http://hi.baidu.com/culion/item/428df54bf36762aede2a9ff1
- plugin
http://wicky.nillia.ms/headroom.js/ http://makotot.github.io/sidebar/ http://www.nodebeginner.org/in ...