cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Costas Matrozos <>
Date Tue, 14 Oct 2003 18:39:33 GMT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-7">
<body text="#000000" bgcolor="#ffffff">
<small><small><small><big>The following patch relates to two issues.<br>
A. (possibly a bug) <br>
    When a jsp is beeing called from within an agreegation,
'sitemapURI' is not part of the servletPath. It results to a null
    I believe it is safer to extract the 'servletPath'  by locating the
last occurance of '/'.<br>
    (has been tested and works fine)<br>
B. (suggestion. A beter way may already exists)<br>
    My aim is to make 'manager' and more specifically the DB pool
object availbe to JSP so that it can use it to make access DB.<br>
    It works just fine.<br>
</big><font face="Courier New, Courier, monospace"><big><br>
RCS file:
retrieving revision 1.7<br>
diff -u -r1.7<br>
---   5 Sep 2003 07:04:35 -0000       1.7<br>
+++   14 Oct 2003 18:19:38 -0000<br>
@@ -104,13 +104,21 @@<br>
                 String servletPath = httpRequest.getServletPath();<br>
                 // remove sitemap URI part<br>
                 String sitemapURI =
-                <font color="#ff0000">servletPath =
servletPath.substring(0, servletPath.indexOf(sitemapURI));</font><br>
<font color="#006600">+                try {<br>
+                  servletPath = servletPath.substring(0,
+                } catch (Exception e) {<br>
+                  // the above statement throws an error when called
in aggregation with<br>
+                  // different name than expected<br>
+                  servletPath = servletPath.substring(0,
servletPath.lastIndexOf("/") + 1);<br>
+                }</font><br>
                 url = servletPath + url;<br>
             engine = (JSPEngine)this.manager.lookup(JSPEngine.ROLE);<br>
             getLogger().debug("JspGenerator executing JSP:" + url);<br>
+           <font color="#006600">// pass manager down to jsp.
Provides handle to DB pool<br>
+           httpContext.setAttribute("manager", manager);</font><br>
             byte[] bytes = engine.executeJSP(url, httpRequest,
httpResponse, httpContext);<br>
             InputSource input = new InputSource(new

View raw message