cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Rohrmeier <Martin.RA.Rohrme...@bmw.de>
Subject Passing xml data from a servlet to cocoon
Date Fri, 22 Aug 2003 08:29:43 GMT
Hi,

i have a web application that generates a data bean. The content of
this bean should be displayed with the help of cocoon 2.0.4. I tried
to convert the bean into xml with castor and then base64 encode the
xml string, as i wanted to pass the string as parameter in the cocoon
http call. In cocoon i defined an xsp-page - which is the first xsp
code that i wrote - that should decode the String again. The result
however is a NullPointerException. Does anybody have a hint what i am
doing wrong here.


servlet	
	//populate bean
	MyBean tBean = new MyBean();
	tBean.set(...)
	//convert bean to xml
	Writer tWriter = new StringWriter();
	Marshaller.marshal(tBean, tWriter);
	//base64 encode the result
	String tOutput = Base64.encode(tWriter.toString());

cocoon call
	http://localhost/cocoon/report.xml?data=<tOutput>

pipeline
	<map:match pattern="report.xml">
	  <map:generate type="serverpages" src="report.xsp"/>
	  <map:serialize type="xml"/>
	</map:match>

severpage
	<xsp:logic>
	  String value = Base64.decode(request.getParameter("data"));
	</xsp:logic>
	<report>
	  <data><xsp-request:get-parameter name="data"/></data>
	  <value><xsp:expr>value</xsp:expr></value>
	</report>


Maybe my communication mechanism is too complicated. Now the output is
passed to a small jsp, that automatically starts the call to cocoon.
I'd like to post the xml string directly to cocoon and receive the
data with the stream generator, but i have no idea how this can be
achieved from a servlet.


Thanks for your help

Martin


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


Mime
View raw message