You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Ricardo Trindade <Ri...@myrealbox.com> on 2002/06/07 11:29:55 UTC

pdf output from java code

Hi,

	I'm using JasperReports, which generates PDF and other reports from XML
descriptions.
	I'm able to run it inside cocoon, to produce reports that I save to files.
However I want to display them on-line.

	My general question is, I want to run java code inside a XSP, but instead
of returning XML, that code generates binary info that I want to stream to
the browser.

	Is XSP the way to go ?

thanks
Ricardo


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: pdf output from java code

Posted by "Sreenivasan N." <sr...@ap.sony.com>.
Hi ,

It will be helpful to others if you can give the configuration required to 
work with JasperReports in Cocoon.

Regards
sreenivasan.


At 10:29 AM 6/7/02 +0100, you wrote:
>Hi,
>
>         I'm using JasperReports, which generates PDF and other reports 
> from XML
>descriptions.
>         I'm able to run it inside cocoon, to produce reports that I save 
> to files.
>However I want to display them on-line.
>
>         My general question is, I want to run java code inside a XSP, but 
> instead
>of returning XML, that code generates binary info that I want to stream to
>the browser.
>
>         Is XSP the way to go ?
>
>thanks
>Ricardo
>
>
>---------------------------------------------------------------------
>Please check that your question has not already been answered in the
>FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
>To unsubscribe, e-mail: <co...@xml.apache.org>
>For additional commands, e-mail: <co...@xml.apache.org>








"Attitudes are much more important than aptitudes."
"Nothing is impossible for a willing heart"

Sreenivasan N.
Sony SARD
Ext 232

Email. sreenivasan.n@ap.sony.com
Per: nsreenivasan@yahoo.com


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


RE: CIncludeT-SQLT- XSLT

Posted by Luca Morandini <lu...@tin.it>.
> -----Original Message-----
> From: David LAGARDERE [mailto:dlagardere@yahoo.fr]
> Sent: Friday, June 07, 2002 12:41 PM
> To: cocoon-users@xml.apache.org; lmorandini@ieee.org
> Subject: RE: CIncludeT-SQLT- XSLT
>
>
>  --- Luca Morandini <lu...@tin.it> a écrit :
> > David,
> >
> > may you try prefixing the elements produced by
> > SQLTransformer with the
> > "sql:" namespace in your XSL (like in: <xsl:template
> > match="table/sql:rowset">) ?
> >
> > Best regards,
> >
> >
>
> Many thanks, Luca.
> It was the problem ! But I really don't
> understand why the sql namespace declaration and
> the namespace prefix don't appear in the resulting
> XML code (I mean, if I take a snapshot before the
> XSLT transformation). Does Cocoon hide it ?

well, I wondered the same and didn't find an explanation for it... could you
spare some time to investigate the matter ?

I apologize for not being of much assistance... right now I'm horribly
busy... this will be the second working-weekend in a row :(

Best regards,

---------------------------------------------
               Luca Morandini
               GIS Consultant
              lmorandini@ieee.org
http://utenti.tripod.it/lmorandini/index.html
---------------------------------------------

>
>
> ___________________________________________________________
> Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
> Yahoo! Mail : http://fr.mail.yahoo.com


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


RE: CIncludeT-SQLT- XSLT

Posted by David LAGARDERE <dl...@yahoo.fr>.
 --- Luca Morandini <lu...@tin.it> a écrit :
> David,
> 
> may you try prefixing the elements produced by
> SQLTransformer with the
> "sql:" namespace in your XSL (like in: <xsl:template
> match="table/sql:rowset">) ?
> 
> Best regards,
> 
> 

Many thanks, Luca.
It was the problem ! But I really don't
understand why the sql namespace declaration and
the namespace prefix don't appear in the resulting
XML code (I mean, if I take a snapshot before the 
XSLT transformation). Does Cocoon hide it ?


___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


RE: CIncludeT-SQLT- XSLT

Posted by Luca Morandini <lu...@tin.it>.
David,

may you try prefixing the elements produced by SQLTransformer with the
"sql:" namespace in your XSL (like in: <xsl:template
match="table/sql:rowset">) ?

Best regards,


---------------------------------------------
               Luca Morandini
               GIS Consultant
              lmorandini@ieee.org
http://utenti.tripod.it/lmorandini/index.html
---------------------------------------------


> -----Original Message-----
> From: David LAGARDERE [mailto:dlagardere@yahoo.fr]
> Sent: Friday, June 07, 2002 12:15 PM
> To: cocoon-users@xml.apache.org
> Subject: CIncludeT-SQLT- XSLT
>
>
> Hello.
>
> I got more details about what I thought being
> an error with Xalan and XPath.
> What I'm doing is getting data from a main XML file
> including other XML files containg SQL requests with
> the cinclude::include. These requests are processed in
> another pipeline and SQL data is retrieved thanks to
> the SQL Transformer and xml serialized. I finally get
> the resulting data from the "SQL pipeline" in the
> first pipeline (thanks to the CInclude transformer)
> which is passed to an XSLT transformer and html
> serialized.
>
> My problem is that the resulting XML is not processed
> by XSLT as expected :
>
> ==> Main XML page <==
>
> <?xml version="1.0" encoding="UTF-8"?>
> <search
> xmlns:ci="http://apache.org/cocoon/include/1.0">
> 	<ci:include src="cocoon:/sql/table.xml"/>
> </search>
>
> ==> Resulting XML <==
>
> <search>
>  <table>
>   <rowset>
>   <!-- Some data fetched by the SQL transformer -->
>   </rowset>
>  </table>
> </search>
>
> ==> XSL applied <==
>
> <xsl:template match="search">
>  <!-- Some HTML -->
>  <xsl:apply-templates select="table/rowset">
>  <!-- Some HTML -->
> </xsl:template>
>
> <xsl:template match="table/rowset">
>  <!-- Some HTML -->
> </xsl:template>
>
> The (bad) result I get is that the "table/rowset"
> template is never reached !
>
> Here is the sitemap :
>
> <map:pipelines>
>  <map:pipeline>
>   <map:match pattern="sql/**.xml">
>    <map:generate src="xml/sql/{1}.xml"/>
>    <map:transform type="sql">
>     <map:parameter name="use-connection"
> value="personnel"/>
>     <map:parameter name="show-nr-of-rows"
> value="false"/>
>    </map:transform>
>    <map:serialize type="xml"/>
>   </map:match>
>  </map:pipeline>
>  <map:pipeline>
>   <map:match pattern="**.xml">
>    <map:generate src="xml/{1}.xml"/>
>    <map:transform type="cinclude"/>
>    <map:transform src="xsl/{1}.xsl" type="xslt"/>
>    <map:serialize type="xml"/>
>   </map:match>
>  </map:pipeline>
> </map:pipelines>
>
> NB:the same happens if I use one pipeline
> and three matchers
>
> I really some help to get around this...
>
> Thanks in advance
>
> David LAGARDERE
>
> ___________________________________________________________
> Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
> Yahoo! Mail : http://fr.mail.yahoo.com
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To unsubscribe, e-mail: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
>


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


CIncludeT-SQLT- XSLT

Posted by David LAGARDERE <dl...@yahoo.fr>.
Hello.

I got more details about what I thought being
an error with Xalan and XPath.
What I'm doing is getting data from a main XML file
including other XML files containg SQL requests with
the cinclude::include. These requests are processed in
another pipeline and SQL data is retrieved thanks to
the SQL Transformer and xml serialized. I finally get
the resulting data from the "SQL pipeline" in the
first pipeline (thanks to the CInclude transformer)
which is passed to an XSLT transformer and html
serialized.

My problem is that the resulting XML is not processed
by XSLT as expected :

==> Main XML page <==

<?xml version="1.0" encoding="UTF-8"?>
<search
xmlns:ci="http://apache.org/cocoon/include/1.0">
	<ci:include src="cocoon:/sql/table.xml"/>
</search>	

==> Resulting XML <==

<search>
 <table>
  <rowset>
  <!-- Some data fetched by the SQL transformer -->
  </rowset>
 </table>
</search>

==> XSL applied <==

<xsl:template match="search">
 <!-- Some HTML -->
 <xsl:apply-templates select="table/rowset">
 <!-- Some HTML -->
</xsl:template>

<xsl:template match="table/rowset">
 <!-- Some HTML -->
</xsl:template>

The (bad) result I get is that the "table/rowset"
template is never reached !

Here is the sitemap :

<map:pipelines>
 <map:pipeline>			
  <map:match pattern="sql/**.xml">
   <map:generate src="xml/sql/{1}.xml"/>
   <map:transform type="sql">
    <map:parameter name="use-connection"
value="personnel"/>
    <map:parameter name="show-nr-of-rows"
value="false"/> 
   </map:transform>
   <map:serialize type="xml"/>
  </map:match>
 </map:pipeline>
 <map:pipeline>
  <map:match pattern="**.xml">
   <map:generate src="xml/{1}.xml"/>
   <map:transform type="cinclude"/>
   <map:transform src="xsl/{1}.xsl" type="xslt"/>
   <map:serialize type="xml"/>
  </map:match>
 </map:pipeline>
</map:pipelines>

NB:the same happens if I use one pipeline
and three matchers

I really some help to get around this...

Thanks in advance

David LAGARDERE

___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


RE: pdf output from java code

Posted by Vadim Gritsenko <va...@verizon.net>.
> From: Ricardo Trindade [mailto:Ricardo.Trindade@myrealbox.com]
> 
> Hi,
> 
> 	Wouldn't it still make more sense to use the action to generate
it and
> the
> reader to display it ?

Do you want to buffer whole PDF in memory? What if it is huge? Reader
will allow you to send parts of PDF as soon as this part is done.


> 	I'm assuming actions can place stuff somewhere that's accessible
to
> readers... the pipeline ??

Request or session attributes.

Vadim


> thanks
> Ricardo
> 
> -----Original Message-----
> From: Vadim Gritsenko [mailto:vadim.gritsenko@verizon.net]
> Sent: terca-feira, 11 de Junho de 2002 13:48
> To: cocoon-users@xml.apache.org
> Subject: RE: pdf output from java code
> 
> 
> > From: Ricardo Trindade [mailto:Ricardo.Trindade@myrealbox.com]
> >
> > ok,
> >
> > 	I think I'll follow the action + reader path. Do I have to
> > implement a custom reader ?
> 
> Not necessarily, except case below.
> 
> 
> > 	I never want the PDF to exist as a file, I want to generate it
> > and deliver it on the fly.
> 
> In this case, instead of action, you will need to write custom reader
> which will generate PDF and serve it without writing to the disk.
> 
> Vadim
> 
> 
> > 	I'll give back any code I write.
> >
> > thanks
> > Ricardo
> >
> >
> > -----Original Message-----
> > From: Vadim Gritsenko [mailto:vadim.gritsenko@verizon.net]
> > Sent: sexta-feira, 7 de Junho de 2002 14:30
> > To: cocoon-users@xml.apache.org
> > Subject: RE: pdf output from java code
> >
> >
> > > From: Ricardo Trindade [mailto:Ricardo.Trindade@myrealbox.com]
> > >
> > > Hi,
> > >
> > > 	I'm using JasperReports, which generates PDF and other reports
> > > from XML descriptions.
> > > 	I'm able to run it inside cocoon, to produce reports that I save
> > > to files.
> > > However I want to display them on-line.
> > >
> > > 	My general question is, I want to run java code inside a XSP,
> > > but instead
> > > of returning XML, that code generates binary info that I want to
> > > stream to the browser.
> > >
> > > 	Is XSP the way to go ?
> >
> > No.
> >
> > XSP must generate XML. You could generate XHTML with link to
required
> > PDF or do a redirect with META or Javascript.
> >
> > Better way will be to code an action, and have map:read nested into
it
> > which will serve generated file.
> >
> >
> > Vadim
> >
> >
> > > thanks
> > > Ricardo


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


RE: pdf output from java code

Posted by Ricardo Trindade <Ri...@myrealbox.com>.
Hi,

	Wouldn't it still make more sense to use the action to generate it and the
reader to display it ?

	I'm assuming actions can place stuff somewhere that's accessible to
readers... the pipeline ??

thanks
Ricardo

-----Original Message-----
From: Vadim Gritsenko [mailto:vadim.gritsenko@verizon.net]
Sent: terca-feira, 11 de Junho de 2002 13:48
To: cocoon-users@xml.apache.org
Subject: RE: pdf output from java code


> From: Ricardo Trindade [mailto:Ricardo.Trindade@myrealbox.com]
>
> ok,
>
> 	I think I'll follow the action + reader path. Do I have to
implement a
> custom reader ?

Not necessarily, except case below.


> 	I never want the PDF to exist as a file, I want to generate it
and
> deliver it on the fly.

In this case, instead of action, you will need to write custom reader
which will generate PDF and serve it without writing to the disk.

Vadim


> 	I'll give back any code I write.
>
> thanks
> Ricardo
>
>
> -----Original Message-----
> From: Vadim Gritsenko [mailto:vadim.gritsenko@verizon.net]
> Sent: sexta-feira, 7 de Junho de 2002 14:30
> To: cocoon-users@xml.apache.org
> Subject: RE: pdf output from java code
>
>
> > From: Ricardo Trindade [mailto:Ricardo.Trindade@myrealbox.com]
> >
> > Hi,
> >
> > 	I'm using JasperReports, which generates PDF and other reports
> from XML
> > descriptions.
> > 	I'm able to run it inside cocoon, to produce reports that I save
> to
> > files.
> > However I want to display them on-line.
> >
> > 	My general question is, I want to run java code inside a XSP,
> but
> > instead
> > of returning XML, that code generates binary info that I want to
> stream to
> > the browser.
> >
> > 	Is XSP the way to go ?
>
> No.
>
> XSP must generate XML. You could generate XHTML with link to required
> PDF or do a redirect with META or Javascript.
>
> Better way will be to code an action, and have map:read nested into it
> which will serve generated file.
>
>
> Vadim
>
>
> > thanks
> > Ricardo
> >
>
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To unsubscribe, e-mail: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
>
>
>
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>



---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>



---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


RE: pdf output from java code

Posted by Vadim Gritsenko <va...@verizon.net>.
> From: Ricardo Trindade [mailto:Ricardo.Trindade@myrealbox.com]
> 
> ok,
> 
> 	I think I'll follow the action + reader path. Do I have to
implement a
> custom reader ?

Not necessarily, except case below.


> 	I never want the PDF to exist as a file, I want to generate it
and
> deliver it on the fly.

In this case, instead of action, you will need to write custom reader
which will generate PDF and serve it without writing to the disk.

Vadim


> 	I'll give back any code I write.
> 
> thanks
> Ricardo
> 
> 
> -----Original Message-----
> From: Vadim Gritsenko [mailto:vadim.gritsenko@verizon.net]
> Sent: sexta-feira, 7 de Junho de 2002 14:30
> To: cocoon-users@xml.apache.org
> Subject: RE: pdf output from java code
> 
> 
> > From: Ricardo Trindade [mailto:Ricardo.Trindade@myrealbox.com]
> >
> > Hi,
> >
> > 	I'm using JasperReports, which generates PDF and other reports
> from XML
> > descriptions.
> > 	I'm able to run it inside cocoon, to produce reports that I save
> to
> > files.
> > However I want to display them on-line.
> >
> > 	My general question is, I want to run java code inside a XSP,
> but
> > instead
> > of returning XML, that code generates binary info that I want to
> stream to
> > the browser.
> >
> > 	Is XSP the way to go ?
> 
> No.
> 
> XSP must generate XML. You could generate XHTML with link to required
> PDF or do a redirect with META or Javascript.
> 
> Better way will be to code an action, and have map:read nested into it
> which will serve generated file.
> 
> 
> Vadim
> 
> 
> > thanks
> > Ricardo
> >
> 
> 
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
> 
> To unsubscribe, e-mail: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
> 
> 
> 
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
> 
> To unsubscribe, e-mail:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>



---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


RE: pdf output from java code

Posted by Ricardo Trindade <Ri...@myrealbox.com>.
ok,

	I think I'll follow the action + reader path. Do I have to implement a
custom reader ?

	I never want the PDF to exist as a file, I want to generate it and deliver
it on the fly.

	I'll give back any code I write.

thanks
Ricardo


-----Original Message-----
From: Vadim Gritsenko [mailto:vadim.gritsenko@verizon.net]
Sent: sexta-feira, 7 de Junho de 2002 14:30
To: cocoon-users@xml.apache.org
Subject: RE: pdf output from java code


> From: Ricardo Trindade [mailto:Ricardo.Trindade@myrealbox.com]
>
> Hi,
>
> 	I'm using JasperReports, which generates PDF and other reports
from XML
> descriptions.
> 	I'm able to run it inside cocoon, to produce reports that I save
to
> files.
> However I want to display them on-line.
>
> 	My general question is, I want to run java code inside a XSP,
but
> instead
> of returning XML, that code generates binary info that I want to
stream to
> the browser.
>
> 	Is XSP the way to go ?

No.

XSP must generate XML. You could generate XHTML with link to required
PDF or do a redirect with META or Javascript.

Better way will be to code an action, and have map:read nested into it
which will serve generated file.


Vadim


> thanks
> Ricardo
>


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>



---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


RE: pdf output from java code

Posted by Vadim Gritsenko <va...@verizon.net>.
> From: Ricardo Trindade [mailto:Ricardo.Trindade@myrealbox.com]
> 
> Hi,
> 
> 	I'm using JasperReports, which generates PDF and other reports
from XML
> descriptions.
> 	I'm able to run it inside cocoon, to produce reports that I save
to
> files.
> However I want to display them on-line.
> 
> 	My general question is, I want to run java code inside a XSP,
but
> instead
> of returning XML, that code generates binary info that I want to
stream to
> the browser.
> 
> 	Is XSP the way to go ?

No.

XSP must generate XML. You could generate XHTML with link to required
PDF or do a redirect with META or Javascript.

Better way will be to code an action, and have map:read nested into it
which will serve generated file.


Vadim


> thanks
> Ricardo
> 


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>