cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Fagerstrom <>
Subject Re: JSP integration
Date Tue, 17 Jul 2007 10:08:04 GMT
Joerg Heinicke skrev:
> On 16.07.2007 04:32, Daniel Fagerstrom wrote:
>>> From what I understand other servlets need to be registered in Cocoon
>>> (or the underlying Spring container). Doesn't that make it
>>> a servlet container in a servlet container?
>> Yes, but the internal "container" is very light weight.
>> So I would say that it is very far from the "almighty Cocoon syndrome".
> Ok, sorry for implying that. The only alternative is probably to use 
> the shared application context as mentioned in the thread about 
> "interblock communication" [1].
I guess that would mean that each Cocoon block should be a war and have 
its own web.xml and application context. I'm not certain that it would 
simplify things.

> With the current servlet service framework I just don't know how to 
> integrate JSPs - what this thread was actually about.
Isn't the standard way of integrating JSP to just call it through a 
RequestDispatcher that you get from 
ServletContext.getRequestDispatcher(String path)? The servlet protocol 
just sets up request and response objects and call other servlets 
through by the request dispatcher it gets from the current servlet 
context. The servlet service fw executes each servlet (service) in its 
own context, so you can't access other servlets (or JSP) through the 
getRequestDispatcher method. To access other servlet services, one 
instead use getNamedDispatcher.

Now currently there is no way to get the original context which is 
needed to dispatch to e.g. JSP. But that is of course something that we 
should make available. The simplest way to do it would be to have some 
reserved name for the original context, "root" e.g. then one could 
dispatch to that by asking for a named dispatcher with the name "root" 
or by using the servlet service protocol: "servlet:root:/". Implementing 
it would, AFAICS, as simple as extending 
o.a.c.servletservice.ServletServiceContext.getNamedContext, so that it 
returns the wraped root context (super) when asked for "root".

One could also think of registering a special purpose servlet service 
that connects to the root context and that servlet services needs to 
connect to if they want to call the root context, but I think that would 
be overkill.



View raw message