“预链接”来自不同目录的 JSP
我们有一个设置,可以让客户特定的 JSP 文件覆盖我们服务中的默认 JSP 文件。部署时,将从客户目录复制自定义 JSP 文件并覆盖默认 JSP 文件。
但这对于开发来说是不利的,因为我们无法就地开发,而必须等待 JSP 部署目标运行才能在浏览器中重新加载。
我一直在考虑在开发时以某种方式“预链接”JSP 文件,这意味着 JSP servlet 应该首先尝试加载给定的 JSP 路径,如 /customer/component/test.jsp 中的 /component/test.jsp,如果没有的话从默认位置加载它。
我可以使用 servlet 过滤器轻松完成此操作,但这不适用于 jsp include,而且我相信 struts 等框架使用请求调度程序完成的任何转发也是如此。
我认为通过扩展 Tomcat/Jaspers JspServlet 类可以解决这个问题,但我希望有一种更简单(也许符合标准)的方法?
We have a setup where we can have customer specific JSP files overriding default JSP files in our service. On deployment the custom JSP files are copied from a customer directory and overwrites default JSP files.
This is bad for development though, as we cannot develop inplace, but have to wait for a JSP-deploy target to run before we can reload in the browser.
I've been thinking of somehow 'prelinking' JSP files when developing, meaning that the JSP servlet should first try to load a given JSP path, says /component/test.jsp from /customer/component/test.jsp, and if not load it from the default location.
I can do this easily with a servlet filter, but this doesn't work with jsp includes, and I believe also any forwards done by frameworks such as struts etc, which uses the request dispatcher.
I think it would be solvable by extending Tomcat/Jaspers JspServlet class, but I was hoping there's a simpler (maybe standards compliant) way?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在tomcat前面放一个nginx/apache怎么样?在ngnix中,当请求到来时,它首先检查
/customer/component/test.jsp
是否存在,如果存在,则将请求转发到带有 url 的 tomcat:
否则
how about put a nginx/apache in front of tomcat? in the ngnix, when a request comes, it first check whether
/customer/component/test.jsp
exists,if exists forward request to tomcat with url:
otherwise