How to access files on server through Tomcat mapped path?

By configuring the server.xml file under E:\Tomcat7.0\conf, the steps are as follows

1. Open the server.xml file under E:\Tomcat7.0\conf.

2、 <Host name="www.hthjx.cn"  appBase="webapps"

            unpackWARs="true" autoDeploy="true">

            <!-- Here is the server address-->

            <Alias>csdn.yake.cn</Alias>   
       
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="localhost_access_log." suffix=".txt"
               pattern="%h %l %u %t "%r" %s %b" />
               

        <Context path="" docBase="D:\webRoot\XX" debug="0" reloadable="true"/>

        <!--The file path is: D:\XXX\XXXX-->

        <!--path="/virtual path"-->

        <!--docBase="/true path"-->

        <!--Context can have multiple, keep path different -->

        <Context path="/dataRoot" docBase="D:\XXX\XXXX" debug="0" reloadable="true"/>
      </Host>

3. Configure a variable, which is configured in the properties file here

dataRoot = / dataRoot

Server address + variable ${dataRoot} + file path.


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325906537&siteId=291194637
Recommended