我有一个静态html,imgs,Flash内容的文件夹在webapp文件夹之外。现在我正在使用符号链接将该文件夹映射到我的webapp目录中。我遇到的问题是当我取消部署应用程序时,它遵循符号链接并删除所有这些文件。包装默认的servlet,但覆盖默认的webapp路径
我试图实现的解决方案之一是一个特殊的servlet,它包装默认的servlet,但使用不同的相对路径。我很难找到如何以覆盖默认servlet路径的方式来包装默认servlet。
这里是我的工作:
public void doGet(final HttpServletRequest req, final HttpServletResponse resp)
throws ServletException, IOException {
final RequestDispatcher rd = getServletContext().getNamedDispatcher("default");
final HttpServletRequest wrapped = new HttpServletRequestWrapper(req) {
@Override
public String getServletPath() {
return "/usr/depot/repository";
}
};
rd.forward(wrapped, resp);
}
不幸的是,内容需要在安全过滤器后面进行保护。我们已经为大多数静态内容运行apache httpd,但他的文件夹是特殊的。我同意这是一个黑客攻击。 – Ruggs