migrate from weblogic to tomcat: directory mapping--reference

Question:

I am trying to migrate from weblogic to tomcat. in weblogic I have

<virtual-directory-mapping> <local-path>E:/internal</local-path>

For example I have mysite project. It means that localhost:8080/mysite/ = E:/internal and I can get a file from E:/internal through localhost:8080/mysite/

localhost:8080/mysite/file.jsp

I whole project is used:

src="<%=request.getContextPath()%>/file.jsp"

In this article there is an examle how to map local folder to tomcat.

This
6. Now inside the above xml file put the following line: <context docbase="d:/images"></context>

doesnt work for me. I changed it to

(1) <Context docBase="E:/internal"></Context>

It works. But I have a problem. For example I have localhost:8080/mysite/about page.

When I use (1) mapping

src="<%=request.getContextPath()%>/file.jsp" doesnt work because it returns mysite/file.jsp

when I try to map mysite by creating mysite.xml the project is not starting because mysite is a site url.

How can I resolve this problem?

Answer:

The best thing is probably to map each item in E:\Internal individually using the aliases attribute of your <Context> (see http://tomcat.apache.org/tomcat-7.0-doc/config/context.html). Note that using / as an "alias path" is not allowed, which is why you'd have to map each item in E:\Internalindividually.

It would be better if you could use a particular URL space for E:\Internal like /internal/[something] and map the whole directory as an alias, but that might not be feasible for your project.

If you really want to "merge" the two directories (that is, resources from both E:\Internal and CATALINA_BASE/webapps/mysite are available via URLs like /mysite/foo, then you will have to use the VirtualDirContext like this:

<Context> <Resources className="org.apache.naming.resources.VirtualDirContext" extraResourcePaths="/=E:\Internal" /> </Context>

(See http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Virtual_webapp andhttp://tomcat.apache.org/tomcat-7.0-doc/config/resources.html#VirtualDirContext_implementation).

原文地址:http://stackoverflow.com/questions/20400465/migrate-from-weblogic-to-tomcat-directory-mapping

转载于:https://www.cnblogs.com/davidwang456/p/3907333.html

  • 0
    点赞
  • 0
    评论
  • 0
    收藏
  • 扫一扫,分享海报

表情包
插入表情
评论将由博主筛选后显示,对所有人可见 | 还能输入1000个字符
©️2021 CSDN 皮肤主题: 编程工作室 设计师:CSDN官方博客 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值