开发者

Deliver files from a web server from outside the web app

开发者 https://www.devze.com 2022-12-31 23:14 出处:网络
Is there anyway to serve a file from 开发者_如何学Ca web server through the web, that is not within the web application.

Is there anyway to serve a file from 开发者_如何学Ca web server through the web, that is not within the web application.

I am using Tomcat and a Java servlets based application.

I don't want to put the files within the webapp because they are several 100GB and I will have to replace them every time I update the WAR if I put them inside it.


Apache web server can serve static files and delegate dynamic content requests to Tomcat.


You can simply map a URL to a servlet and the servlet can open the file from anywhere and read bytes from the fileinputsream and write them to the response output stream. You should add browser cache headers and also compress the data as you write it to the browser see http://onjava.com/pub/a/onjava/2003/11/19/filters.html

0

精彩评论

暂无评论...
验证码 换一张
取 消