tomcat&jetty虚拟路径配置
2017-01-10 11:24
281 查看
tomcat
在tomcat解压目录的conf->Catalina->localhost文件夹下新建一个xml文件。path名称需和文件一致内容为
jetty
1. 在jetty解压目录的webapps文件下新建一个xml文件,内容为:
将该xml重命名为resource.xml,contextPath的名称是什么就命名成什么.启动jetty之后,就可以通过 http://localhost:8080/resource 来访问 F:\document\resource 中的资源文件了。
2. 或者在jetty.xml中加入如下代码:
jetty相关配置未在本地测试,不保证完全正确。
以上所有方法均推荐第一种。
参考文章
http://blog.csdn.net/le_59/article/details/51774809
http://goinglw.iteye.com/blog/454187
在tomcat解压目录的conf->Catalina->localhost文件夹下新建一个xml文件。path名称需和文件一致内容为
<?xml version="1.0" encoding="UTF-8"?> <Context path="/resource" docBase="F:\document\resource" reloadable="true" /> </xml>
2. 或者直接修改server.xml文件,在Host标签中添加
<Context path="/resource" docBase="F:\document\resource" reloadable="true" />
jetty
1. 在jetty解压目录的webapps文件下新建一个xml文件,内容为:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd"> <Configure class="org.eclipse.jetty.server.handler.ContextHandler"> <Set name="contextPath">/resources</Set> <Set name="handler"> <New class="org.eclipse.jetty.server.handler.ResourceHandler"> <Set name="resourceBase">F:\document\resource</Set> <Set name="directoriesListed">true</Set> </New> </Set> </Configure>
将该xml重命名为resource.xml,contextPath的名称是什么就命名成什么.启动jetty之后,就可以通过 http://localhost:8080/resource 来访问 F:\document\resource 中的资源文件了。
2. 或者在jetty.xml中加入如下代码:
<Set name="handler"> <New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection"> <Set name="handlers"> <Array type="org.eclipse.jetty.server.Handler"> <Item> <New id="Contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection"/> <Set name="contextPath">/resource</Set> </Item> <Item> <New id="DefaultHandler" class="org.eclipse.jetty.server.handler.DefaultHandler"/> <Set name="resourceBase">F:\document\resource</Set> <Set name="directoriesListed">true</Set> </Item> </Array> </Set> </New> </Set>
jetty相关配置未在本地测试,不保证完全正确。
以上所有方法均推荐第一种。
参考文章
http://blog.csdn.net/le_59/article/details/51774809
http://goinglw.iteye.com/blog/454187
相关文章推荐
- Tomcat&Jetty 虚拟路径配置
- Tomcat&Jetty 虚拟路径配置
- tomcat配置多域名,虚拟目录,修改work路径
- Tomcat 5.5 配置多域名和多虚拟路径
- tomcat部署项目虚拟主机虚拟路径配置
- 关于tomcat虚拟路径配置
- tomcat配置jsp虚拟路径
- tomcat虚拟路径的几种配置方法
- tomcat虚拟路径的几种配置方法
- Tomcat 6 配置虚拟主机<域名/二级域名>,并通过Tomcat控制台对多个Host进行管理
- tomcat虚拟路径的几种配置方法
- tomcat虚拟路径的几种配置方法
- Tomcat6配置虚拟路径,部署多应用
- Tomcat5.5配置虚拟路径
- tomcat虚拟路径的配置
- Tomcat 虚拟路径配置
- Tomcat 服务器虚拟路径的几种配置方式
- Tomcat7.0配置虚拟路径
- Tomcat 配置虚拟路径映射
- Tomcat 服务器虚拟路径的几种配置方式