https://bz.apache.org/bugzilla/show_bug.cgi?id=69382
Bug ID: 69382 Summary: Inefficient code generated for <jsp:include> Product: Tomcat 9 Version: 9.0.x Hardware: PC Status: NEW Severity: normal Priority: P2 Component: Jasper Assignee: dev@tomcat.apache.org Reporter: jeng...@amazon.com Target Milestone: ----- This JSP fragment: <jsp:include page="${feature.template}"> <jsp:param name="featureName" value="${feature.featureName}"/> </jsp:include> translates into a single, very long line of Java: org.apache.jasper.runtime.JspRuntimeLibrary.include(request, response, (java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${feature.template}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null) + (((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${feature.template}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null)).indexOf('?')>0? '&': '?') + org.apache.jasper.runtime.JspRuntimeLibrary.URLEncode("featureName", request.getCharacterEncoding())+ "=" + org.apache.jasper.runtime.JspRuntimeLibrary.URLEncode((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${feature.featureName}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null), request.getCharacterEncoding()), out, false); Formatting is unhelpful, however there's a problem buried in there: "${feature.template}" is evaluated twice, presumably with the same output both times. The JSP snippet clearly does not intend two evaluations so it should be possible to execute once and reuse the value. In addition, there are two calls to request.getCharacterEncoding()... which seems simple until our application wraps that value multiple layers deep: ServletRequestWrapper ServletRequestWrapper ApplicationHttpRequest ApplicationHttpRequest ApplicationHttpRequest ApplicationHttpRequest RequestFacade Request Reusing this value would also be helpful. -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org