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/ ...
随机推荐
- 【转】NSString / NSData / char* 类型之间的转换
原文 :http://www.cnblogs.com/pengyingh/articles/2341880.html NSString 转换成NSData 对象 NSData* xmlData = [ ...
- 使用第三方SDK出现: duplicate symbol _llvm.cmdline in:
如果是同一个静态库中的文件链接的时候有冲突,可能是这个静态库不支持模拟器,真机运行就好了. 或者可以使用xcode7的虚拟机跑也是没问题的. duplicate symbol _llvm.cmdlin ...
- spring web flow 2.0入门(转)
Spring Web Flow 2.0 入门 一.Spring Web Flow 入门demo(一)简单页面跳转 附源码(转) 二.Spring Web Flow 入门demo(二)与业务结合 附源码 ...
- Starting and Stopping Oracle Fusion Middleware
指定用户名密码启动管理服务器 You can start and stop Oracle WebLogic Server Administration Servers using the WLST c ...
- CSU 1616: Heaps(区间DP)
题目链接:http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1616 1616: Heaps Time Limit: 2 Sec Memory Lim ...
- 使用mysql作为hive的元数据库
1.hive下载安装 2.下载mysql安装 3.以root用户进入mysql命令行:mysql -uroot -p(提示输入密码) 4.创建hive的元数据库:create databa ...
- Linux下的Job Control(转:http://blog.chinaunix.net/uid-26495963-id-3062757.html)
一.Job的概念 Job是指在批处理的环境中,为完成某一任务而进行一系列操作的总称.在个人接触计算机的年代,批处理的环境已经不容见到了,只有一些特殊的行业和环境下还在使用这样的概念,仅在书本中接触过. ...
- angularJS学习笔记二
angularJS四个特性 1.MVC <!doctype html> <html ng-app> <head> <meta charset="ut ...
- Tinkphp定时发布文章的教程
第一步:在文章表中加一个字段,用来保存定时发布的时间 假定我把这个字段设为 push_time 默认为 0 第二步:写一个方法来检查文章列表,把文章列表到时间的文章改为发布状态 //定时发布文章 pu ...
- MVC中的模型注解
authour: chenboyi updatetime: 2015-04-26 21:28:42 friendly link: 目录: 1,思维导图 2,内容解析 3,CodeSimple 1, ...