Tomcat下的项目访问本地文件

在tomcat中 server.xml文件中 

    <Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">下面加入

    <Context debug="0" docBase="E:\edu_upload\" path="/file" reloadable="true"/> 这一行 

docBase 你本地文件地址  path 访问是映射地址 

<Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">
<Context debug="0" docBase="E:\edu_upload\" path="/file" reloadable="true"/>
        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        -->


        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t &quot;%r&quot; %s %b" prefix="localhost_access_log." suffix=".txt"/>


      </Host>

猜你喜欢

转载自blog.csdn.net/luo1749334951/article/details/80800982
今日推荐