Tomcat Setup http File download

Source: Internet
Author: User

Tomcat as the HTTP download server, there are many ways online

But I think the simplest is:

1, directly put the file in the/var/lib/tomcat6/webapps/root directory,

2, then in the Web site access: Http://192.168.2.31:8080/download.zip can be downloaded.


However, if you don't want to put it under Webapps/root, configure the directory you want to download:

1, in the Tomcat installation directory \conf\catalina\localhost under the establishment of arbitrary file name XML file, such as: Download.xml,

The contents are as follows:

<?xml version= "1.0" encoding= "UTF-8"?> <context reloadable= "  true" docbase= "D://download" Crosscontext= "true" >

</Context>

2, configure Web.xml (Tomcat configuration file), modify the following configuration:

<servlet>
<servlet-name>default</servlet-name>
<servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<init-param>
<param-name>listings</param-name>
<param-value>false</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>

To change the red false to true.

3, restart Tomcat.

4. Visit http://19.168.23.31:8080/download



Reprint Source: http://blog.csdn.net/yuan882696yan/article/details/26680253

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.