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

Reply via email to