cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Fagerstrom <dani...@nada.kth.se>
Subject Re: Cocoon 2.2 - Use a block for the "root" sitemap
Date Mon, 18 Dec 2006 14:20:45 GMT
The root servlet should be mounted at "" not "/". Alexander had the same 
problem. So even if I find the current behavior intuitive, no one else 
seem to agree ;). So we should probably have special handling of "/" as 
you suggest.

/Daniel

Patrick Refondini skrev:
> As of my tests a block configured to handle "root" sitemap does only 
> strictly answer to / resource call. The rest of its context seems to 
> be inaccessible.
>
> Thus, for instance, if a block testblock1 is configured to handle 
> "root" sitemap and should serve:
> a welcome page at /
> some content at /contact.html
> some resources at /images/**
>
> only the welcome page at / from this block testblock1 will be 
> accessible (with all references to resources,... failing).
>
> Looking at the org.apache.cocoon.blocks.DispatcherServlet source, this 
> behaviour is due to the way the service() method chooses which block 
> (Servlet) to dispatch to:
>
> Added>>>>
> // HARDCODED for root sitemap could be made configurable !?
> private static final String DEFAULT_SERVLET = "/";
> <<<<Added
>
> protected void service(HttpServletRequest req, HttpServletResponse 
> res) throws ServletException, IOException {
>
> (...)
>
>     while (servlet == null && index != -1) {
>         path = path.substring(0, index);
>         servlet = (Servlet)this.mountableServlets.get(path);
>         index = path.lastIndexOf('/');
>     }
>
> Added>>>>
>     // If no servlet were found try to delegate call to DEFAULT_SERVLET
>     if (servlet == null) {
>         servlet = (Servlet)this.mountableServlets.get(DEFAULT_SERVLET);
>     }
> <<<<Added
>
>     if (servlet == null) {
>         throw new ServletException("No block for " + req.getPathInfo());
>     }
>
> (...)
>
> }
>
>
> WDYT ? Any caveheat I overlook ?
>
> Patrick
>


Mime
View raw message