You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Bruce Atherton <br...@callenish.com> on 2007/06/20 01:47:40 UTC

Deploying Cocoon as a Portlet into Jetspeed 2

I am trying to take an existing application running under Cocoon 2.1.9
and deploy it as a set of portlets. Before I get that far, though, I
want to make sure I understand how to deploy Cocoon as a JSR-168
portlet. To that end, I went through the following steps of trying to
get Cocoon to work as a portlet inside Jetspeed 2:

1. I built a WAR file of Cocoon 2.1.9 with the portal block (and
associated dependencies) included, as well as the samples.
2. I checked that the portlet.xml file contained a definition for
CocoonPortlet (as it does out of the box).
3. I deployed the cocoon.war file to the Tomcat instance running Jetspeed 2
4. I modified
${Jetspeed-2.1}/webapps/jetspeed/WEB-INF/pages/default-page.psml to include:
    <fragment id="dp-19" type="portlet" name="cocoon::CocoonPortlet">
      <property name="row" value="7"/>
      <property name="column" value="0"/>
    </fragment>
5. I started Jetspeed.
6. I navigated to the Jetspeed default page.

Instead of seeing the expected hello world business, I get this error
message: "Portlet Application cocoon not available".

Have I missed a step here? What am I missing to get a basic build of
Cocoon to deploy as a portlet in Jetspeed 2?

Thanks for any help.




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Help using xmodule

Posted by Hugh Sparks <hu...@csparks.com>.
In my application, I need to send a large xml DOM thing back
to the pipeline from flowscript. To simplify the question, I
created a short but tested example:

In flowscript, I create a doc from a string and try to send it back:

 var str = "<test>This is a test</test>" ;
 var parser = 
cocoon.getComponent(Packages.org.apache.excalibur.xml.dom.DOMParser.ROLE);
 var reader = new Packages.java.io.StringReader(str) ;
 var source = new Packages.org.xml.sax.InputSource(reader) ;
 var doc = parser.parseDocument(source);
 cocoon.releaseComponent(parser);
 cocoon.sendPage("makedomReply", {message: doc}) ;

In the sitemap:

 <map:match pattern="makedomReply">
         <map:generate src="xmodule:flow-attr:message"/>
         <map:serialize type="xml"/>
 </map:match>

Browser error:

 org.xml.sax.SAXException: The object type: class java.lang.String
 could not be serialized to XML: This is a test

>From the stacktrace and source code, it is clear that XModuleSource.toSAX
got a java String instead of the Document I tried to send.

Using module with a plain javascript string works without an error:

 doc = "<test>This is a test</test>" ;
 cocoon.sendPage("downloadReply", {message: doc}) ;

 <map:match pattern="downloadReply">
         <map:generate src="module:flow-attr:message"/>
         <map:serialize type="xml"/>
 </map:match>

I guess I'm confused about what xmodule is supposed to deal
with. Or perhaps I'm not making the dom object correctly.

Thanks to all and greetings to the list,

-Hugh Sparks

Version: Cocoon 2.1.11-dev svn export from 2007-06-11





---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Deploying Cocoon as a Portlet into Jetspeed 2

Posted by Gabriel Gruber <Ga...@workflow.at>.
Hello Bruce,

We recently switched from OpenSessionInView Filter to OpenSessionInView 
Interceptor  by extending the CocoonServlet. We discovered some odd 
behavior in the flush mode. it seems Flushmode is set to FLUSH_AUTO 
instead of FLUSH_NEVER as expected. I haven't investigated it further 
though. Could also be an issue of the Spring version we use (1.2.8).

Greetings,

Gabriel

______________________
Mag. Gabriel Gruber
Senior Consultant
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Workflow EDV GmbH, Dannebergplatz 6/23, A-1030 Wien




Bruce Atherton <br...@callenish.com> 
28.06.2007 06:06
Please respond to
users@cocoon.apache.org


To
users@cocoon.apache.org
cc

Subject
Re: Deploying Cocoon as a Portlet into Jetspeed 2






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: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org



Re: Deploying Cocoon as a Portlet into Jetspeed 2

Posted by Bruce Atherton <br...@callenish.com>.
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: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Deploying Cocoon as a Portlet into Jetspeed 2

Posted by Bruce Atherton <br...@callenish.com>.
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.

Bruce Atherton wrote:
> I am trying to take an existing application running under Cocoon 2.1.9
> and deploy it as a set of portlets. Before I get that far, though, I
> want to make sure I understand how to deploy Cocoon as a JSR-168
> portlet. To that end, I went through the following steps of trying to
> get Cocoon to work as a portlet inside Jetspeed 2:
>
> 1. I built a WAR file of Cocoon 2.1.9 with the portal block (and
> associated dependencies) included, as well as the samples.
> 2. I checked that the portlet.xml file contained a definition for
> CocoonPortlet (as it does out of the box).
> 3. I deployed the cocoon.war file to the Tomcat instance running Jetspeed 2
> 4. I modified
> ${Jetspeed-2.1}/webapps/jetspeed/WEB-INF/pages/default-page.psml to include:
>     <fragment id="dp-19" type="portlet" name="cocoon::CocoonPortlet">
>       <property name="row" value="7"/>
>       <property name="column" value="0"/>
>     </fragment>
> 5. I started Jetspeed.
> 6. I navigated to the Jetspeed default page.
>
> Instead of seeing the expected hello world business, I get this error
> message: "Portlet Application cocoon not available".
>
> Have I missed a step here? What am I missing to get a basic build of
> Cocoon to deploy as a portlet in Jetspeed 2?
>
> Thanks for any help.
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org