cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Patrick Refondini <patrick.refond...@pobox.com>
Subject Re: Cocoon 2.2 - Use a block for the "root" sitemap
Date Mon, 18 Dec 2006 16:04:23 GMT
Daniel Fagerstrom wrote:
> 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.
I just tested "" configuration and it does exactly what I was looking 
for, uh ! Although having special handling of "/", if found acceptable 
in term of coding, could be valuable for dummy users like I :O) or those 
who won't read the docs.
Talking about documentation, would this:
http://cocoon.zones.apache.org/daisy/cdocs-site-main/g2/1291.html
be the place where the block protocol and configurations like these 
could be best described ?

Patrick

> 
> /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