On 05/09/2016 16:13, Fung wrote: > I'm going to get it right now. > I make a xml file "download.xml" at > apache-tomcat-8.0.15\conf\Catalina\localhost,the contents are as follows: > > > <?xml version="1.0" encoding="UTF-8"?> > <Context docBase="F:\nas" /> > > > > And,open the tomcat web.xml listings to true. > This is done.Now I can access F:\nas by http://localhost:8080/download/ > > > But there are still problems.Why the independent context file's name must be > the path name?
Because that is the way it is designed. Think about it. If it were anything else, how would Tomcat know which web application the file was meant to apply to? > And why I set "Context path='xxx'",the path never work? Did you read the Context docs [1]? Again, think about it. If I have directories $CATALINA_BASE/webapps/app1 and $CATALINA_BASE/webapps/app2 and a file $CATALINA_BASE/webapps/app1/META-INF/context.xml that contains path="/app2" what happens? It gets even more 'interesting' if you add auto-deployment into the mix. The current behaviour is designed so that Tomcat's behaviour is consistent and easy to understand across a wide range of edge cases. In particular it ensures it is impossible to deploy 2 web applications with conflicting paths. To give you an idea of how complex this could get, look at the automatic deployment behaviour [2] and start thinking about how messy things would get if editing a context.xml file could change a deployment path (and hence create conflicting paths). Mark [1] http://tomcat.apache.org/tomcat-8.0-doc/config/context.html [2] http://tomcat.apache.org/tomcat-8.0-doc/config/automatic-deployment.html --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org