The struggle continues.
The resolution to my last post was to do an XSL transform on all
"action" URLs to prepend "portlet:action:" and to strip off the servlet
path altogether, since the portal container provides it from the entry
in portlet.xml (I believe).
Now my problem is that my hibernate OpenSessionInViewFilter is never
called when accessing cocoon as a portlet. This is because there are no
equivalent portlet filters defined by JSR-168 (although they are
apparently coming in JSR-268). The Spring Web Framework gets around this
by wrapping its web processing with an OpenSessionInViewInterceptor.
So my question is a rather basic Cocoon one. Is there a way to configure
Cocoon to basically do the equivalent of a Servlet Filter without using
a Servlet Filter? IOW, to wrap Cocoon.process(env) so that on entry it
always calls a preprocess() type method, and on exit (no matter how it
exits), to always call a postprocess() type method?
I imagine the answer is "yes" since Cocoon 2.1 predates Servlet filters
and has all that funky Avalon stuff, I'm just uncertain how to do it.
The alternative is to write my own ManagedCocoonPortlet and wrap the
processAction() and render() methods with the equivalent Hibernate
Session creation and destruction that OpenSessionInView does. But that
solution seems rather clunky to me.
Does anyone have any suggestions?
Bruce Atherton wrote:
Continuing my saga of trying to get a Cocoon application deployed as a
JSR-168 servlet into Jetspeed, I am experiencing the following odd
behaviour:
When I call getServletPath() from a page that is called by the portal
container, it returns without a leading slash. The exact same page
when accessed through cocoon as a servlet results in getServletPath()
returning WITH a leading slash. The lack of the leading slash is
causing the EncodeURLTransformer to fail.
To be clear, I deploy a webapp called "myapp" with a portlet
"myportlet". The root sitemap has:
<map:match pattern="myportlet">
<map:mount check-reload="yes" src="myapp/portlet-sitemap.xmap"
uri-prefix="myportlet"/>
</map:match>
<map:match pattern="myportlet/**">
<map:mount check-reload="yes" src="myapp/portlet-sitemap.xmap"
uri-prefix="myportlet"/>
</map:match>
The portlet-sitemap.xmap has:
<map:match pattern="">
<map:call function="displayServletPath"/>
</map:match>
The WEB-INF/portlet.xml has:
<init-param>
<name>servlet-path</name>
<value>myportlet</value>
</init-param>
I also tried changing the value to "/myportlet" but it had no effect.
The displayServletPath flowscript function displays a form that
outputs the value of the expression
${cocoon.request.getServletPath()}. When accessing
http://localhost:8080/myapp/myportlet/, getServletPath() returns
"/myportlet". When accessed through the portal, it returns "myportlet".
Has anyone got any suggestions as to why that is occurring and how to
get around it? Could it have anything to do with the issues raised in
this blog entry? http://bluxte.net/blog/2006-03/29-40-33.html
Again, any help appreciated.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]