cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Stevens <at...@hotmail.com>
Subject RE: JSP integration
Date Sat, 14 Jul 2007 00:38:39 GMT

Reposted, since I didn't get a copy from the list and don't see it in the archives.  Apologies
if you've seen it already.



> Date: Thu, 12 Jul 2007 11:31:51 +0200
> From: gkossakowski@apache.org
>
> Joerg Heinicke pisze:
> > On 02.07.2007 20:19, Andrew Stevens wrote:
> >
> >> And then inspiration hit - why not instead create a new input Source
> >> for JSPs?
> >>
> >> And then I started to over-think it :-) Why only JSPs? Why not
> >> servlets too? How does this differ from the context: source type?
> >> Surely someone must have thought of doing this before - is there no
> >> similar facility already? What about in Cocoon 2.2 - would the
> >> servlet/blocks framework that keeps getting discussed cater for this
> >> anyway? At which point I figured the best thing to do was to dump my
> >> thoughts to the list and see if anyone had any feedback or
> >> suggestions...
> >
> > Hi Andrew,
> >
> > your ideas sound absolutely reasonable. I appreciate every improvement
> > to the integration of JSP or servlets in general though I don't use it
> > myself (yet). In 2.1 I would really opt for a new source. I only wonder
> > if this is necessary at all in 2.2. I got the impression (just from
> > mailing list) it should be quite easy to integrate Cocoon with other
> > servlets but somebody with actual knowledge might add more details here.
> > What I for example would really like to have is a CocoonView for
> > Spring's ViewRendererServlet or use Cocoon as replacement for the
> > ViewRendererServlet.
>
> Yep, you are right Joerg and Andrew, servlet-service-fw is the way to go.
>
> Basically, you need to register JSP servlet as Spring bean, then you can connect to it
from other servlet (Cocoon block) using its bean's Id
> and use servlet:/ source for this. Take a look at:
> [1] for servlet configuration as spring bean
> [2] for demo servlet itself

Ah, that might be a problem then.  In Websphere 6 (and presumably later versions too), the
JSP engine isn't actually a servlet any more - they use a new "server extension" architecture
to handle requests for JSPs (I assume through some interception mechanism).  In our existing
2.1.x app, I got it working by creating a new JSPEngine implementation that looks up the RequestDispatcher
for the supplied URL and calls include or forward directly on that (instead of using JSPEngineImplNamedDispatcherInclude
to look up "JSP 1.2 Processor" servlet, which I'd been doing on WAS 5.x). **
How would that fit into the servlet-service-fw?


Andrew.


** NB  I also had to remove the "*.jsp" servlet mapping from the Cocoon servlet, so JSPs are
now run directly by the container instead of going through Cocoon first.  It means you can't
have Cocoon map "whatever.jsp" requests to some other pipeline that doesn't call the JSP engine,
but we weren't doing that anyway. Without it, however, pipelines like

would go into an endless loop as the "foo/{1}.jsp" request is also directed through Cocoon
and matches the same pipeline...

> All needed functionality is already there and working, it's a matter of providing sample
and (really preferably) some documentation how to
> utilize servlet-service-fw functionality to integrate with JSP.
>
> [1]
> http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-sample/src/main/resources/META-INF/cocoon/spring/cocoon-servlet-service-demo1-servletService.xml?view=markup
> [2]
> http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-servlet-service/cocoon-servlet-service-sample/src/main/java/org/apache/cocoon/servletservice/demo1/DemoServlet.java?view=markup
>
> --
> Grzegorz Kossakowski
> http://reflectingonthevicissitudes.wordpress.com/

_________________________________________________________________
Try Live.com - your fast, personalised homepage with all the things you care about in one
place.
http://www.live.com/?mkt=en-gb  
Mime
View raw message