Wrap the default servlet but override the default webapp path

后端 未结 6 1941
故里飘歌
故里飘歌 2020-12-10 20:33

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.

6条回答
  •  佛祖请我去吃肉
    2020-12-10 21:16

    You can either write your own servlet to serve static content (which is not that hard) or try to extend rather than wrap the DefaultServlet. Either way, your resulting servlet will have be configured in place of default in your web.xml (using "default" as servlet-name).

    That said, DefaultServlet will only serve static content from under your webapp context; in order to change that you'll have to create / bind to JNDI your own ProxyDirContext instance pointing to the outside folder and I'm not sure whether that will work; its configuration process is rather involved.

    Trying to override servlet path will not get you anywhere.

提交回复
热议问题