我有一个用 Java + spring 框架编写的网络应用程序。使用的应用服务器是 tomcat。假设 Web 应用程序名称是“sample-webapp”。如果我像这样在 sample-webapp/resources/ 下创建一个符号链接-
ls -l
.../sample-webapp/resources/temp-csv-location -> /tmp/csv-location
这里的“temp-csv-location”是一个符号链接。
现在,如果我在 jsp 页面中引用此目录中的文件,例如
<a href="http://localhost:8080/sample-webapp/resources/temp-csv-location/test.csv">Click</a>
它给了我一个 404 错误。我确认 test.csv 文件存在于 /tmp/csv-location/ 中。我也确认了权限。在普通的 tomcat 用法中,我们可以在 context.xml 中添加“allowLinking=true”。
有没有办法在spring框架中做到这一点?