Configure the Weblogical virtual directory to provide download services __web

Source: Internet
Author: User

Using the output stream to provide file downloads in your project is too much trouble, and if you use the WebLogic Web application server in your project, we can use the Virtual directory Mapping feature provided in WebLogic, which is very handy for file download services.

1. Create a new Web application and set its context path, for example: download

2. New Weblogic.xml under Web-inf

<?xml Version = ' 1.0 ' encoding = ' UTF-8 '?> <weblogic-web-app ' xmlns:xsi=
Xmlschema-instance "
                  xsi:schemalocation=" Http://www.bea.com/ns/weblogic/weblogic-web-app 
                  http:// Www.bea.com/ns/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd "
                  xmlns=" http://www.bea.com/ns/weblogic/ Weblogic-web-app ">
  <virtual-directory-mapping>
    <!--local path-->
    <local-path>f:/ Resources</local-path>
    <!--URL matching-->
    <url-pattern>/*</url-pattern>
  </ Virtual-directory-mapping>
</weblogic-web-app>
3. Deploy this Web application and use the download feature:

If you have a A.doc file under the local path you configured, you can download the file by using the link http://localhost/download/A.doc.

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.