cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mustafa Ali, Halgurt" <Mustafa...@docomolab-euro.com>
Subject AW: AW: File existence
Date Fri, 19 Sep 2003 10:59:12 GMT
Hello,

I did it as you said, but I got this error message:

(Exists is not a function)

Another question, when I call the Pipeline handling, I don't have just ID as parameter, even
more, how can I pass these parameters to the non-exists pipeline? 
Here is my pipelines:

<map:flow language="javascript">
  <map:script src="flow/exists.js"/>
  </map:flow>
 <map:pipelines>
 <map:pipeline>
   <map:match pattern="handling">
     <map:call function="exists">
     <map:parameter name="test-uri" value="context://{request-param:ID}.xml"/>
     <map:parameter name="exists-uri" value="exists"/>
     <map:parameter name="non-exists-uri" value="non-exists"/>
     </map:call>
     </map:match>
  </map:pipeline>
  <map:pipeline>
   <map:match pattern="exists">
   <map:generate type="file" src="{request-param:ID}.xml"/>
       <map:transform type="xslt" src="form3data.xsl">
       <map:parameter name="use-request-parameters" value="true"/>
    </map:transform>
    <map:serialize type="html"/>
</map:match>
   </map:pipeline>
   <map:pipeline>
   <map:match pattern="non-exists">
<map:generate type="file" src="default.xml"/>
       <map:transform type="xslt" src="form2data.xsl">
       <map:parameter name="use-request-parameters" value="true"/>
    </map:transform>
    <map:transform type="write-source">
    <map:parameter name="use-request-parameters" value="true"/>
    </map:transform>
	<map:transform type="xslt" src="form2html.xsl" mime-type="text/xml">
    <map:parameter name="use-request-parameters" value="true"/>
    </map:transform>
    <map:serialize type="html"/>
</map:match>

-----Ursprüngliche Nachricht-----
Von: Upayavira [mailto:uv@upaya.co.uk] 
Gesendet: Freitag, 19. September 2003 11:08
An: users@cocoon.apache.org
Betreff: Re: AW: File existence

You seem to be having a lot of trouble with this. Have you considered 
using flow? With the below, if the file exists, the pattern="exists" 
pipeline will be shown, otherwise the pattern="non-existent" pipeline 
will be shown.

<map:match pattern="page">
  <map:call function="exists">
   <map:parameter name="test-uri" value="context://{request-param:ID}.xml"/>
    <map:parameter name="exist-uri" value="exists"/>
    <map:parameter name="non-exist-uri" value="non-existent"/>
  </map:call>
</map:match>

<map:match pattern="exists">
  whatever
</map:match>

<map:match pattern="non-existent">
  whatever
</map:match>

In your sitemap, just before the <map:pipelines> element:
  <map:flow language="javascript">
    <map:script src="flow/exists.js"/>
  </map:flow>

Create a file called flow/exists.js:

function exists() {
  var file = new java.io.File(cocoon.parameters["test-uri"]);
  if (file.exists()) {
     cocoon.sendPage(cocoon.parameters["exists-uri"];
  } else {
     cocoon.sendPage(cocoon.parameters["non-exist-uri"];
  }
}

HTH. Regards, Upayavira

Mustafa Ali, Halgurt wrote:

>Oh, you are right, I changed it, but the pipeline still choose the second part, no matter
whether the file exists or not, it ignores the <act>...</act> part, do you have
an Idea what is perhaps wrong?
>
>Thanks,
>Halgurt
>PS: I am a Kurd and my first name is Halgurt, we don't have surnames, Mustafa is my father
and Ali my Grandfather.
>
>-----Ursprüngliche Nachricht-----
>Von: Olivier Billard [mailto:obillard@rennes.jouve.fr] 
>Gesendet: Freitag, 19. September 2003 10:02
>An: users@cocoon.apache.org
>Betreff: Re: File existence
>
>Hi Halgurt (I'm french and didn't manage to see what is your name and first name, so sorry

>if i'm wrong),
>
>Please check if you *really* didn't wrote {request-parameter:ID} instead of 
>{request-param:ID}, because the error seem to point a mistake of this type...
>see :
>cause: org.apache.avalon.framework.component.ComponentException: *input-modules*: 
>ComponentSelector could not find the component for hint [*request-parameter*] (key 
>[*request-parameter*])
>
>-> this should be request-param...
>
>--
>Olivier
>
>
>On 19/09/2003 10:30, Mustafa Ali, Halgurt wrote:
>
>  
>
>>Sure, here is it:
>>
>>    
>>
>
><snip/>
>
>  
>
>>cause: org.apache.avalon.framework.component.ComponentException: input-modules: ComponentSelector
could not find the component for hint [request-parameter] (key [request-parameter])
>>
>>
>>
>>-----Ursprüngliche Nachricht-----
>>Von: Olivier Billard [mailto:obillard@rennes.jouve.fr] 
>>Gesendet: Freitag, 19. September 2003 09:19
>>An: users@cocoon.apache.org
>>Betreff: Re: AW: AW: AW: AW: File existence
>>
>>Can you send the exact error and the stack trace you got ?
>>    
>>
>
>  
>



---------------------------------------------------------------------
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


Mime
View raw message