You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by joakim verona <jo...@verona.se> on 2003/12/28 03:43:27 UTC

request parameters and processPipelineTo?

Hello list,

I'm trying to write the output of a pipeline to a fiel from a flowscript 
using "processPipelineTo".

It fails because I cant figure out a way to send request parameters to 
the pipeline.


the pipeline looks like this:

     <map:match pattern="parseimdbtitle">
    <map:generate type="html"
              src="http://www.imdb.com/title/{request-param:imdbtitle}" />
   
    <map:transform src="stylesheets/parseimdbtitle.xsl"/>
    <map:serialize type="xml"/>
      </map:match>

Heres one flowscript fragment that doesnt work:

      
cocoon.processPipelineTo("parseimdbtitle?imdbtitle="+bizdata.imdbtitle,bizdata,out);

I get:

   No pipeline matched request: famelib/parseimdbtitle?imdbtitle=tt0276751/


If I dont build the query parameter string like this:

cocoon.processPipelineTo("parseimdbtitle",bizdata,out);

and bizdata contains the wanted request parameter, it doesnt work 
either, because
the parameter map is not sent as a request parameter.


So I guess my basic question is: how do I make a pipeline that can take 
both request parameters and
"bizdata" parameters at the same time? Or is it the other way around? 
Should the pipeline
be made to accept "bizdata" parameters only?


/Joakim


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


database issuses - (cocoon + mysql)

Posted by beyaRecords - The home Urban music <uz...@beya-records.com>.
Hi,
I am having an issue connecting to a MySQL database. Basically, any 
esql tags with data between them is being written to the screen instead 
of being processed and no connection to the database is being made. For 
example instead of <esql:pool>mysql</esql:pool> being processed, 
'mysql' is being printed to the screen. What am i not doing correctly? 
The process I followed to try and ensure database connectivity was 
this:

1. Copy JDBC driver for MySQL into CATALINA_HOME/common/lib
2. Define a MySQL datasource:

<datasources>
     <jdbc logger="core.datasources.mysql" name="mysql">
       <pool-controller max="10" min="5"/>
       <auto-commit>false</auto-commit>
       <dburl>jdbc:mysql://localhost/test</dburl>
       <user>user</user>
       <password>password</password>
     </jdbc>
</datasources>

3. edit CATALINA_HOME/webapps/cocoon/web-inf/web.xml
     <init-param>
       <param-name>load-class</param-name>
       <param-value>
       	<!-- MySQL -->
       	 org.gjt.mm.mysql.Driver
       	
       	<!-- PostgreSQL -->
       	org.postgresql.Driver

       </param-value>
     </init-param>

4. xsp code:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsp:page language="java" xmlns:xsp="http://apache.org/xsp" 
xmlns:esql="htp://apache.org/cocoon/SQL/v2" 
xmlns:xsp-session="http://apache.org/xsp/session/2.0">
<page>
	<title>trouble tickets</title>
	<content>
		<esql:connection>
			<esql:pool>mysql</esql:pool>
				<esql:execute-query>
					<esql:query>select * from TroubleTickets</esql:query>
						<esql:results>
							<tickets>
								<esql:row-results>
									<ticket>
										<esql:get-columns/>
									</ticket>
								</esql:row-results>
							</tickets>
						</esql:results>
						<esql:no-results>
        						<p>Sorry, no results!</p>
     					</esql:no-results>
				</esql:execute-query>
		</esql:connection>
	</content>
</page>
</xsp:page>

5. xsl snippet:

		<xsl:template  match="tickets">
			<table border="1"  width="100%">
				<xsl:apply-templates/>
			</table>
		</xsl:template>
		
		<xsl:template match="ticket">
			<tr>
				<xsl:for-each select="*">
					<td><xsl:apply-templates/></td>
				</xsl:for-each>
			</tr>
		</xsl:template>

regards


Uzo
On 28 Dec 2003, at 10:40, Luca Morandini wrote:

> joakim verona wrote:
>> So I guess my basic question is: how do I make a pipeline that can 
>> take both request parameters and
>> "bizdata" parameters at the same time? Or is it the other way around? 
>> Should the pipeline
>> be made to accept "bizdata" parameters only?
>
> Well, let's put it this way: if I had to send two parameters ("x" and 
> "y") to pipeline "foo.xml", I'd do the following ("os" being the 
> pipeline's output and "x" and "y2 the Javascript variables holding 
> request parameters' values):
>
> cocoon.processPipelineTo('foo.xml', {'x' : x, 'y' : y}, os);
>
> Regards,
>
> -----------------------------------
> Luca Morandini   -   GIS Consultant
> lmorandini@ieee.org
> http://xoomer.virgilio.it/ukmorand/
> -----------------------------------
>
>
>
> ---------------------------------------------------------------------
> 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


Re: request parameters and processPipelineTo?

Posted by Gianluca Morello <mo...@S1.my-tv.it>.
Hi Luca,

i had the same problem on cocoon 2.1.1 passing parameters with
processPipelineTo in flow.

if you have still that problem
try this:

in flow:

out=new java.io.FileOutputStream("/tmp/out.xml");
cocoon.processPipelineTo("parseimdbtitle/tt0338466", null,out)

in the sitemap:

<map:match pattern="parseimdbtitletst/*">
   <map:generate type="html"   src="http://www.imdb.com/title/{1}" />
   <map:serialize type="xml"/>
</map:match>

Best regards
Gianluca

----- Original Message -----
From: "Luca Morandini" <lu...@tin.it>
To: <us...@cocoon.apache.org>
Sent: Monday, December 29, 2003 12:58 PM
Subject: Re: request parameters and processPipelineTo?


> Joakim Verona wrote:
>
> > I tried pasting in your test pipeline in my sitemap, and it returns the
> > xml version of the imdb page as expected.
> >
> > <map:match pattern="parseimdbtitletst">
> >   <map:generate type="html"
> >       src="http://www.imdb.com/title/tt0338466" />
> >   <map:serialize type="xml"/>
> > </map:match>
> >
> > So we are not having the exact same behaviour.
> >
> > Some questions for you:
> >
> > 1) Which version of cocoon are you running? I'm running 2.1.3 on sun
> > linux jdk 1.4.2_02
>
> Cocoon 2.1.2, JDK 1.4.1_01 on Windows 2000. Anyway, I've checked it
> again and still doesn't work
>
>
> > 2) When you send parameters to a pipeline from flowscript, do you use
> > {request-param:imdbtitle} to receive them?
>
> BTW, I've completely overlooked the reception of parameters in your
> sitemap (my bad :( ): you cannot, AFAIK, use them as request parameters,
> since they're Javascript objects.
>
> Instead, you should use the jpath logicsheet or JXTransformer or
> JXTemplate to use them. I'am afraid you have to change the logic of your
> application considerably.
>
> Regards,
>
> -----------------------------------
> Luca Morandini   -   GIS Consultant
> lmorandini@ieee.org
> http://xoomer.virgilio.it/ukmorand/
> -----------------------------------
>
>
>
> ---------------------------------------------------------------------
> 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


Re: request parameters and processPipelineTo?

Posted by Luca Morandini <lu...@tin.it>.
Joakim Verona wrote:

> I tried pasting in your test pipeline in my sitemap, and it returns the 
> xml version of the imdb page as expected.
> 
> <map:match pattern="parseimdbtitletst">
>   <map:generate type="html"
>       src="http://www.imdb.com/title/tt0338466" />
>   <map:serialize type="xml"/>
> </map:match>
> 
> So we are not having the exact same behaviour.
> 
> Some questions for you:
> 
> 1) Which version of cocoon are you running? I'm running 2.1.3 on sun 
> linux jdk 1.4.2_02

Cocoon 2.1.2, JDK 1.4.1_01 on Windows 2000. Anyway, I've checked it 
again and still doesn't work


> 2) When you send parameters to a pipeline from flowscript, do you use 
> {request-param:imdbtitle} to receive them?

BTW, I've completely overlooked the reception of parameters in your 
sitemap (my bad :( ): you cannot, AFAIK, use them as request parameters, 
since they're Javascript objects.

Instead, you should use the jpath logicsheet or JXTransformer or 
JXTemplate to use them. I'am afraid you have to change the logic of your 
application considerably.

Regards,

-----------------------------------
Luca Morandini   -   GIS Consultant
lmorandini@ieee.org
http://xoomer.virgilio.it/ukmorand/
-----------------------------------



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


Re: request parameters and processPipelineTo?

Posted by Joakim Verona <jo...@verona.se>.
Luca,

I tried pasting in your test pipeline in my sitemap, and it returns the 
xml version of the imdb page as expected.

<map:match pattern="parseimdbtitletst">
   <map:generate type="html"
       src="http://www.imdb.com/title/tt0338466" />
   <map:serialize type="xml"/>
</map:match>

So we are not having the exact same behaviour.

Some questions for you:

1) Which version of cocoon are you running? I'm running 2.1.3 on sun 
linux jdk 1.4.2_02
2) When you send parameters to a pipeline from flowscript, do you use 
{request-param:imdbtitle} to receive them?

Regards,
/Joakim

Luca Morandini wrote:

> joakim verona wrote:
>
>> Luca,
>>
>> This seems brilliant, but in my case it doesnt work. What am I doing 
>> wrong?
>>
>> My pipeline:
>>      <map:match pattern="parseimdbtitle">
>>    <map:generate type="html"
>>              
>> src="http://www.imdb.com/title/{request-param:imdbtitle}" /><!-- 
>> doesnt need url encoding because imdbtitle always one word -->
>>      <map:transform src="stylesheets/parseimdbtitle.xsl"/>
>>    <map:serialize type="xml"/>
>>      </map:match>
>>
>> Flow fragment:
>>      out=new java.io.FileOutputStream("/tmp/out.xml");
>>      cocoon.processPipelineTo("parseimdbtitle",  
>> {"imdbtitle":"tt0338466"}  ,out)
>>
>> Error:
>>      Could not get resource http://www.imdb.com/title/
>>
>> To me it seems to indicate that {request-param:imdb} is empty when 
>> the pipeline is called.
>
>
> I beg to differ, I tried:
> <map:match pattern="parseimdbtitle">
>    <map:generate type="html"
>        src="http://www.imdb.com/title/tt0338466" />
>    <map:serialize type="xml"/>
> </map:match>
>
> getting the same "Resource not found" error: smells like a 
> HTMLGenerator issue to me.
>
> Regards,
>
> -----------------------------------
> Luca Morandini   -   GIS Consultant
> lmorandini@ieee.org
> http://xoomer.virgilio.it/ukmorand/
> -----------------------------------
>
>
>
> ---------------------------------------------------------------------
> 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


Re: request parameters and processPipelineTo?

Posted by Luca Morandini <lu...@tin.it>.
joakim verona wrote:

> Luca,
> 
> This seems brilliant, but in my case it doesnt work. What am I doing wrong?
> 
> My pipeline:
>      <map:match pattern="parseimdbtitle">
>    <map:generate type="html"
>              src="http://www.imdb.com/title/{request-param:imdbtitle}" 
> /><!-- doesnt need url encoding because imdbtitle always one word -->
>      <map:transform src="stylesheets/parseimdbtitle.xsl"/>
>    <map:serialize type="xml"/>
>      </map:match>
> 
> Flow fragment:
>      out=new java.io.FileOutputStream("/tmp/out.xml");
>      cocoon.processPipelineTo("parseimdbtitle",  
> {"imdbtitle":"tt0338466"}  ,out)
> 
> Error:
>      Could not get resource http://www.imdb.com/title/
> 
> To me it seems to indicate that {request-param:imdb} is empty when the 
> pipeline is called.

I beg to differ, I tried:
<map:match pattern="parseimdbtitle">
    <map:generate type="html"
        src="http://www.imdb.com/title/tt0338466" />
    <map:serialize type="xml"/>
</map:match>

getting the same "Resource not found" error: smells like a HTMLGenerator 
issue to me.

Regards,

-----------------------------------
Luca Morandini   -   GIS Consultant
lmorandini@ieee.org
http://xoomer.virgilio.it/ukmorand/
-----------------------------------



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


Re: request parameters and processPipelineTo?

Posted by joakim verona <jo...@verona.se>.
Luca,

This seems brilliant, but in my case it doesnt work. What am I doing wrong?

My pipeline:
      <map:match pattern="parseimdbtitle">
    <map:generate type="html"
              src="http://www.imdb.com/title/{request-param:imdbtitle}" 
/><!-- doesnt need url encoding because imdbtitle always one word -->
   
    <map:transform src="stylesheets/parseimdbtitle.xsl"/>
    <map:serialize type="xml"/>
      </map:match>

Flow fragment:
      out=new java.io.FileOutputStream("/tmp/out.xml");
      cocoon.processPipelineTo("parseimdbtitle",  
{"imdbtitle":"tt0338466"}  ,out)

Error:
      Could not get resource http://www.imdb.com/title/

To me it seems to indicate that {request-param:imdb} is empty when the 
pipeline is called.


/Joakim


Luca Morandini wrote:

> joakim verona wrote:
>
>> So I guess my basic question is: how do I make a pipeline that can 
>> take both request parameters and
>> "bizdata" parameters at the same time? Or is it the other way around? 
>> Should the pipeline
>> be made to accept "bizdata" parameters only?
>
>
> Well, let's put it this way: if I had to send two parameters ("x" and 
> "y") to pipeline "foo.xml", I'd do the following ("os" being the 
> pipeline's output and "x" and "y2 the Javascript variables holding 
> request parameters' values):
>
> cocoon.processPipelineTo('foo.xml', {'x' : x, 'y' : y}, os);
>
> Regards,
>
> -----------------------------------
> Luca Morandini   -   GIS Consultant
> lmorandini@ieee.org
> http://xoomer.virgilio.it/ukmorand/
> -----------------------------------
>
>
>
> ---------------------------------------------------------------------
> 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


Re: request parameters and processPipelineTo?

Posted by Luca Morandini <lu...@tin.it>.
joakim verona wrote:
> So I guess my basic question is: how do I make a pipeline that can take 
> both request parameters and
> "bizdata" parameters at the same time? Or is it the other way around? 
> Should the pipeline
> be made to accept "bizdata" parameters only?

Well, let's put it this way: if I had to send two parameters ("x" and 
"y") to pipeline "foo.xml", I'd do the following ("os" being the 
pipeline's output and "x" and "y2 the Javascript variables holding 
request parameters' values):

cocoon.processPipelineTo('foo.xml', {'x' : x, 'y' : y}, os);

Regards,

-----------------------------------
Luca Morandini   -   GIS Consultant
lmorandini@ieee.org
http://xoomer.virgilio.it/ukmorand/
-----------------------------------



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