I have a folder of static html,imgs,flash content that lives outside of the webapp folder. Right now I'm using a symbolic link to map that folder into my webapp directory. The problem i have is when I undeploy my application it follows the symbolic link and deletes all these files.
One of the solutions I'm trying to implement is a special servlet that wraps the default servlet but uses a different relative path. I'm having trouble finding out how to wrap the default servlet in a way that overrides the default servlet path.
Here is what I'm working with:
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);
}