Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在带有 Apache Web 服务器的集群 tomcat 设置中有图像上传逻辑。有没有办法在 web 服务器上而不是 tomcat 上上传图像文件,这样当用户尝试下载上传的图像文件时,它会像静态文件一样被访问?
您可以在 web.xml 中重定向:
<servlet> <servlet-name>images</servlet-name> <servlet-class>uk.co.foo.ImageServer</servlet-class> </servlet> <servlet-mapping> <servlet-name>images</servlet-name> <url-pattern>/images/*</url-pattern> </servlet-mapping>