我有一个在 Wildfly 8.0.0 Final 上运行的 JavaEE 应用程序。
该应用程序使用了很多图像,我不想将它们存储在数据库中,因此它们被写入硬盘。
例如,如何配置 Wildfly/Undertow 以便在某个 URL 上提供这些文件 (/var/images)http://localhost:8080/myapplication/imagesFromDisk
?
在standalone.xml 中向 undertow 子系统添加另一个文件处理程序和另一个位置:
<server name="default-server">
<http-listener name="default" socket-binding="http"/>
<host name="default-host" alias="localhost">
<location name="/" handler="welcome-content"/>
<location name="/img" handler="images"/>
</host>
</server>
<handlers>
<file name="welcome-content" path="${jboss.home.dir}/welcome-content" directory-listing="true"/>
<file name="images" path="/var/images" directory-listing="true"/>
</handlers>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)