Jetty 中的 JSR-45(JSP 中的行号)支持
如何获取来自已编译 JSP 的堆栈跟踪以包含实际 JSP 文件(而不是中间 Servlet java 文件)中的行号?
我正在使用 Jetty 8。我目前正在以编程方式占用 Jetty 实例。
(如果对行号支持内容感兴趣,我使用 Eclipse 进行编码,我不太了解 JSR-45 SMAP 逻辑 - 它是“side car”文件,还是将此信息放入实际的类文件中?)
调试、断点是否有效? JSP?
How do I get the stack traces coming from compiled JSPs to include line numbers from the actual JSP file, not the intermediate Servlet java file?
I am using Jetty 8. I am currently taking up the Jetty instance programmatically.
(I use Eclipse for coding if that is of interest regarding the line number support stuff, I don't quite get the JSR-45 SMAP logic - is it a "side car" file, or is this info put in the actual class files?)
Will debugging, breakpoints work, re. JSPs?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
更新:2017 年 6 月
Jetty 9 不再使用 Glassfish JSP。
它使用 Apache Jasper JSP,适用相同的规则,如下所示。
原始答案
Jetty 使用 Glassfish 项目中的 JspServlet 来管理其所有 JSP 处理。
JspServlet 上有 3 个初始化参数(请参阅 ${jetty.home}/etc/webdefault.xml 内容)可能会有所帮助。
将所有这些开发时间设置设置为 true,您应该会看到更多信息。
以及有中间源文件可供参考。生成的源文件包含一行注释掉的 jsp 源代码,然后生成的 java 源文件,您也可以使用该文件来反向引用 jsp 的哪一行导致了异常。
另请注意,Glassfish 中的 JspServlet 也使用 java.util.logging 作为其底层日志记录基础结构。要查看 JspUsage 的所有细节(包括 jsp 行号),请尝试在 FINEST 级别为“org.apache.jasper”包空间设置 java.util.logging。
Update: June 2017
Jetty 9 no longer uses Glassfish JSP.
It uses Apache Jasper JSP, same rules apply as below.
Original Answer
Jetty uses the JspServlet from the Glassfish project to manage all of its JSP handling.
There are 3 init-parameters on the JspServlet (see
${jetty.home}/etc/webdefault.xml
contents) that might help.Set all of these development time settings to true and you should see more information.
As well as have the intermediate source file to reference. This generated source files contains a line of commented out jsp source, then the resulting java source file that you can also use to backreference which line of your jsp caused the exception.
Also note that the JspServlet from Glassfish also uses java.util.logging as its underlying logging infrastructure. To see all the nitty details of the JspUsage (including jsp line numbers) try setting up java.util.logging for the "org.apache.jasper" package space at the FINEST level.