cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Ratcliffe" <a...@prema.co.nz>
Subject RE: "redirect-to" result of a transformation
Date Tue, 05 Apr 2005 20:44:40 GMT
Yes the uri that gets passed to processPipelineTo() does need to reference a
pipeline that would fetch your content for you, note that in flowscript you
can't use the cocoon: protocol, the path is resolved relative to the current
sitemap, or the root sitemap if you prepend it with a '/'.

I haven't done anything like what you're wanting to do before, but if I was
going to I might be tempted to write a Java component that fetches the web page
and extracts the target URI. You could call this component from within
flowscript with the request parameter identifying the page.  The
cocoon.redirectTo() flowscript function would allow you to redirect to the URI
you got back.

I'm sure there are many other ways of doing this making greater use of sitemap
components to do your processing but sometimes it's just easier to do it in
Java.

HTH
Adam



> -----Original Message-----
> From: news [mailto:news@sea.gmane.org]On Behalf Of Volkm@r
> Sent: Wednesday, 6 April 2005 3:16 a.m.
> To: users@cocoon.apache.org
> Subject: Re: "redirect-to" result of a transformation
>
>
> Adam Ratcliffe wrote:
> > Try cocoon.processPipelineTo(uri, null/*no bizdata*/, output),
> sorry I wrote the
> > example from memory. The link to the relevant documentation is:
> > http://cocoon.apache.org/2.1/userdocs/flow/api.html#processPipelineTo
> >
>
> Hi Adam,
> Thanks a lot for your attention. I'm getting closer to the solution, but
>   I'm not yet there.
>
> What I'm now having is sitemap and flowscript as given below, where
> "Quelle" is something like
> <http://linuxtoday.com/news_story.php3?ltsn=2005-04-05-006-26-OS-DP-NT>.
>
>
> sitemap.xmap
> -------------------------------
> <map:flow language="javascript">
> 	<map:script src="redirect.flow"/>
> </map:flow>
> <map:pipeline>
>    <map:match pattern="LinuxLink">
>      <map:call function="processLinks"/>
>    </map:match>
> </map:pipeline>
> -------------------------------
>
>
> redirect.flow
> -------------------------------
> function processLinks() {
> 	var uri = cocoon.request.getParameter("Quelle");
> 	var output = new Packages.java.io.ByteArrayOutputStream();
> 	cocoon.processPipelineTo(uri, null/*no bizdata*/, output);
> 	var redirectUri = output.toString();
> 	cocoon.redirectTo(redirectUri);
> }
> -------------------------------
>
>
> With this, I'm still getting errors like
> -------------------------------
> An Error Occurred
> protocol = http host = null
> org.apache.avalon.framework.CascadingRuntimeException:
> "file:/path/to/flowscript/redirect.flow", line 4: uncaught JavaScript
> exception: at processLinks (file:/path/to/flowscript/redirect.flow, Line
> 4): org.apache.excalibur.source.SourceException: Cannot get input stream
> for
> cocoon://http://linuxtoday.com/news_story.php3?ltsn=2005-04-05-010-26-RV-HE-SV
>
> cause: java.lang.IllegalArgumentException: protocol = http host = null
> -------------------------------
>
>
> What I'd need I think is something like
>
>         var uri = cocoon:/"myOtherPipe"
>
> to get the desired input stream, but I cannot find the correct command
> for that.
>
> Isn't there an easier solution for making (xpath of) SAX stream
> available to the sitemap?
> --
> Volkm@r
>
>
> ---------------------------------------------------------------------
> 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