Reputation: 153
I am just developing a Java web project which will be deployed under Tomcat 6.0. This project will store a lot of pictures which are uploaded by users. Because there will be a lot of pictures, I don't want to store the pictures in the web project's images path,like: ${docbase}/images/. I want to store these in another file path or even another disk, but not in the ${docbase}. So, how do I configure Tomcat, so that the picture can be visited just like in the ${docbase}?
Should I put those pictures in another web project,then using visual host?
May be I didn't describe my question well. Any advice will be grateful. Thanks
Upvotes: 2
Views: 98
Reputation: 7779
Store the images elsewhere, in a location that can be served by Apache HTTPd. In your database, store the path to the image file. You may want to design the schema so that you can either store the full path (http://....) or just the file name, while you store the server name elsewhere in a configuration or another table. That way you serve the content through the links from other server (you can either pull the links directly from the db, or create them on the fly by concatenating the server name and the image path).
Upvotes: 2
Reputation: 1175
You can look at integrating your tomcat with Apache http server. You can route your dynamic requests to tomcat & serve static/image content from your http server.
Upvotes: 0