在 Apache tomcat 7 上在哪里部署 zip 文件以供下载? [英] Where to deploy zip file on Apache tomcat 7 to be available for download?

查看:31
本文介绍了在 Apache tomcat 7 上在哪里部署 zip 文件以供下载?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过部署在 apache tomcat 7 上的应用程序创建一个 zip 文件.我想让该 zip 文件可供用户下载.我应该将我的 zip 放在 tomcat 服务器上的什么位置以供下载,或者我可以将我的 zip 存储在某个驱动器上并通过 tomcat 映射它们以供下载吗?

I am creating a zip file through my app deployed on apache tomcat 7. I want to make that zip available for download to the users. Where shall I place my zip on tomcat server to be available for download or Can I store my zips on some drive and map them through tomcat to be available for download?

推荐答案

有两种方法.选项 1:将您的 zip 或任何文件放在 webapps 文件夹下,例如/webapps/test/hello.zip.将 zip 放在那里可以通过 http:///test/hello.zip

There are 2 ways to it. Option 1: Put your zip or any file under webapps folder e.g. /webapps/test/hello.zip. Putting zip there can be accessed by http://<host:port>/test/hello.zip

选项 2:您可以映射文件系统上可通过 tomcat 访问的任何目录.为此,您需要在 $Tomcat_home/conf/server.xml 配置 server.xml在标签下添加这个新标签.

Option 2: You can map any directory on your file system accessible via tomcat. To do this you need to configure server.xml at $Tomcat_home/conf/server.xml Add this new tag under tag.

<Context path="/test" docBase="complete_path_of_dir_contaning_zip_file">< / Context >

现在可以通过相同的方式访问 zip http://<host:port>/test/hello.zip

Now zip can be accessed in same way http://<host:port>/test/hello.zip

这篇关于在 Apache tomcat 7 上在哪里部署 zip 文件以供下载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆