Caucho Forums

Caucho Forums (http://forum.caucho.com//index.php)
-   Resin (http://forum.caucho.com//forumdisplay.php?f=4)
-   -   Resin doesn't compile JSP properly while Tomcat does (http://forum.caucho.com//showthread.php?t=27652)

imaniyar 03-17-2011 07:24 AM

Resin doesn't compile JSP properly while Tomcat does
 
I thought the following code was portable. However, Tomcat 6.0.20 does it right, while Caucho Resin Pro 4.0.15 seems to be compiling it wrong.

My JSP code is as follows:

Code:

<jsp:scriptlet> 
    String referrer = request.getHeader("referer"); 
    if( referrer != null ){ 
</jsp:scriptlet> 
 
    <p> 
        You may 
        <jsp:element name="a"> 
            <jsp:attribute name="href"> 
                <jsp:expression>response.encodeURL(referrer)</jsp:expression> 
            </jsp:attribute> 
            <jsp:body>click here</jsp:body> 
        </jsp:element> 
        to return to the page you came from. 
    </p> 
     
<jsp:scriptlet> 
    } 
</jsp:scriptlet>

Tomcat compiles it to the following in the class org.apache.jsp.WEB_002dINF.error_002dpages._404_js p:
_jspService

Code:




String referrer = request.getHeader("referer"); 
if( referrer != null ){ 
                     
      out.write("\r\n"); 
      out.write("\t\t\t\t\t\r\n"); 
      out.write("\t\t\t\t\t\t<p>\r\n"); 
      out.write("\t\t\t\t\t\t\tYou may \r\n"); 
      out.write("\t\t\t\t\t\t\t"); 
      out = _jspx_page_context.pushBody(); 
      out.print(response.encodeURL(referrer)); 
      String _jspx_temp2 = ((javax.servlet.jsp.tagext.BodyContent)out).getString(); 
      out = _jspx_page_context.popBody(); 
      out.write("<" + "a" + " href=\"" + _jspx_temp2 + "\"" + ">"); 
      out.write("click here"); 
      out.write("</" + "a" + ">"); 
      out.write(" \r\n"); 
      out.write("\t\t\t\t\t\t\tto return to the page you came from.\r\n"); 
      out.write("\t\t\t\t\t\t</p>\r\n"); 
      out.write("\t\t\t\t\t\t\r\n"); 
      out.write("\t\t\t\t\t"); 
 



.

Resin compiles it to the following in the class _jsp._web_22dinf._error_22dpages._404_jsp:
_jspService
Code:




String referrer = request.getHeader("referer"); 
if( referrer != null ){ 
                     
    out.write(_jsp_string51, 0, _jsp_string51.length); 
    out.print(_jsp_fragment_4(pageContext, null, null, _jsp_state, _jsp_pageManager));out.write(_jsp_string52, 0, _jsp_string52.length); 
     



.

In String _jsp_fragment_4(

Code:

String _jsp_fragment_4( 
    com.caucho.jsp.PageContextImpl pageContext, 
    javax.servlet.jsp.tagext.JspTag _jsp_parent_tag, 
    javax.servlet.jsp.tagext.JspFragment _jspBody, 
    TagState _jsp_state, 
    com.caucho.jsp.PageManager _jsp_pageManager) 
    throws Throwable 
  { 
    com.caucho.jsp.PageContextImpl _jsp_parentContext = pageContext; 
    JspWriter out = pageContext.pushBody(); 
    javax.el.ELContext _jsp_env = pageContext.getELContext(); 
    javax.servlet.http.HttpServletRequest request = (javax.servlet.http.HttpServletRequest) pageContext.getRequest(); 
    javax.servlet.http.HttpServletResponse response = (javax.servlet.http.HttpServletResponse) pageContext.getResponse(); 
    javax.servlet.http.HttpSession session = pageContext.getSession(); 
    javax.servlet.ServletContext application = pageContext.getServletContext(); 
    javax.servlet.ServletConfig config = pageContext.getServletConfig(); 
    try { 
      out.print((response.encodeURL(referrer))); 
      return ((com.caucho.jsp.BodyContentImpl) out).getString(); 
    } finally { 
      pageContext.popAndReleaseBody(); 
    } 
  }

Due to the function _jsp_fragment_4 that the Coucho Resin jsp compiler produces, Coucho Resin ends up through a INTERNAL SERVER ERROR because it cannot compile the jsp file into a servlet.

Do you think Caucho Resin is at fault?

reza 03-23-2011 10:11 PM

imaniyar,

Please post the stack trace.

Thanks,
Reza

alex 03-29-2011 05:28 PM

imaniyar, I reported this as a bug:
http://bugs.caucho.com/view.php?id=4463

Trivian 10-18-2011 08:41 AM

Much thanks for letting this know. I was currently stuck :confused: ] how to get over it

alex 10-18-2011 05:52 PM

The bug record says it should be fixed in 4.0.17 and higher.
Alex


All times are GMT. The time now is 10:49 PM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.