How to set up a different context to point to an external directory outside webapps Tomcat/Java
I am s开发者_如何转开发uccessful to map an external directory by creating an xml file like :
<Context path="/uploads" docBase="C:\uploads\photos" crossContext="true"/>
And I named this xml file as uploads.xml and saved under "#Tomcat\conf\Catalina\localhost" here # = Directory where Tomcat has been installed. And when I start Tomcat(5) from cammand line (batch file) i.e. startup.bat The images can be accessed normally like "http://localhost:8080/uploads/user1.png"
It works.
Actually I am using IntelliJ Idea 8 for devevelopment. When I start Tomcat from IntelliJ Idea, I am not able to access the context i.e. the images. "http://localhost:8080/uploads/user1.png" It shows "HTTP 400 Bad Request"
The context path for my project is "http://localhost:8080/spark/"
Any help or suggestion is needed at the earliest time.
Looking forward to as many appreciative responses as possible.
Thanx Pink
IntelliJ uses it's own Tomcat Base, so you will need to add a web facet to your project and add your directory there. This is for IntellijJ 9 and 10. I don't have 8.
精彩评论