You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Carlos Maté <cm...@gmail.com> on 2007/01/26 09:34:02 UTC
Re: Applet Servlet communication
Hi.
I can return a string from cocoon but I have problems with special
characters. If I send á or ñ I receive ?
I`ve tried to specify <encoding>ISO-8859-1</encoding> in the text serializer
but It doesn't run.
Thanks.
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"/>
</map:match>
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: http://cocoon.apache.org/2.1/userdocs/flow/sitemap.html for more
information.
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"/>
</map:match>
In this case the test.xml is a jx template that should look something like:
<jx:template xmlns:jx="http://apache.org/cocoon/templates/jx/1.0";>
${something}
</jx:template>
I hope this helps you out.
Kind regards,
Jeroen Reijn
Hippo
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:
http://cocoon.apache.org/2.1/userdocs/concepts/sitemap.html
<http://cocoon.apache.org/2.1/userdocs/concepts/sitemap.html>
http://cocoon.apache.org/2.1/userdocs/concepts/sitemap/sitemap-examples.html
<http://cocoon.apache.org/2.1/userdocs/concepts/sitemap/sitemap-examples.html>
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.