cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeroen Reijn <>
Subject Re: Applet Servlet communication
Date Mon, 02 Oct 2006 10:56:10 GMT

Carlos Maté wrote:
> Hi,
> My applet expects a string as an answer.
> In the sitemap I want to call a function than  calculates the string  
> and send this string to the applet.
> I don't want to serialize any xml document. And if the function is a 
> flowscript I don't know how to do it.
> Thanks.

Hi Carlos,

returning a string from cocoon is no problem. This is what you could do 
in your sitemap.xmap:

1. Create matcher for your request:

<map:match pattern="request-string.html">
   <map:call function="testfunction"/>

2. Create a flowscript function that does just does something with your 
request and calls another pipeline that returns your calculated string:

function testfunction()
   var something = "test";
   cocoon.sendPage("returnstring.html", {something:something});

See: for more 

3. Define the matcher that generates your string:

<map:match pattern="returnstring.html">
   <map:generate src="test.xml" type="jx"/>
   <map:serialize type="text" mime-type="text/plain"/>

In this case the test.xml is a jx template that should look something like:

<jx:template xmlns:jx="">

I hope this helps you out.

Kind regards,

Jeroen Reijn

> Hi Carlos,
> what does your applet expect as an answer? an XML document, a string or 
> something else?
> I think the following two pages wil be of help for you:
>  <>
>  <>
> Regards,
> Jeroen Reijn
> Carlos Maté wrote:
>     Hi.
>     We hava an applet that needs some data. The applet ask for it using
>     a URLConnection. And wait for the answer using
>     urlConnection.getInputStream();
>     Cocoon servlet matches this URL in the sitemap but How can I send de
>     answer ?
>     How do I write the sitemap?
>     Thanks.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message