cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erik Norvelle" <eriknorve...@hotmail.com>
Subject Re: Impossible or not? Combining request-parameter & wildcard matchers in 1 pipe
Date Thu, 19 Sep 2002 23:50:11 GMT
Barbara:

Thanks for the tip.  What ended up working was using the 
org.apache.cocoon.acting.RequestParamAction Action class.  For the sake of 
anyone reading this in the future, here's what I did.

I created an action as follows:
  <map:actions>
     <map:action name="request"
       src="org.apache.cocoon.acting.RequestParamAction"/>
  </map:actions>

I then used this new Action in my pipeline:
   <map:match pattern="*/*/*.*.html*">
     <map:act type="request">
       <map:generate type="file"       
src="http://localhost:8000/{../1}/CalendarRegistry/{../2}/EventCollection/getCataloguedEventsAsXML{requestQuery}"/>
     </map:act>
     <map:transform 
src="http://localhost:8080/mightycal/{1}/{2}/{3}/intermediate-to-html.{4}.xsl"/>
     <map:serialize/>
   </map:match>

The "request" Action provided me with the {requestQuery} parameter that I 
could use to append *all* of the query string to the URI for my XML source.

Note that in order to reference the original positional parameters from the 
WildcardURIMatcher, I had to change {1} to {../1}, etc.

-Erik

==================================================================
Support Systems Analyst
College of Agriculture and Life Sciences
The University of Arizona

>From: "Barbara Post" <babs33@ifrance.com>
>Reply-To: cocoon-users@xml.apache.org
>To: <cocoon-users@xml.apache.org>
>Subject: Re: Impossible or not? Combining request-parameter & wildcard 
>matchers in 1 pipeline
>Date: Thu, 19 Sep 2002 12:22:31 +0200
>
>Just an idea, I am busy yet : use an Action and getParameterNames() method
>if I remember well (look at the API docs), so that you have all the request
>parameters. Then you can put sitemap parameters as you want.
>
>HTH,
>
>Babs
>----- Original Message -----
>From: "Erik Norvelle" <eriknorvelle@hotmail.com>
>To: <cocoon-users@xml.apache.org>
>Sent: Thursday, September 19, 2002 12:18 PM
>Subject: Impossible or not? Combining request-parameter & wildcard matchers
>in 1 pipeline
>
>
> > ************************ Problem Summary **************************
> > I cannot figure out how to use matchers to capture an arbitrary
> > number of request-parameters, in combination with using a wildcard
> > matcher to parse the structure of the request URI.  I seem to be
> > limited to capturing only a single request-parameter at once, in
> > a situation when the number & names of parameters is not predictable.
> > *******************************************************************
> >
> > Here's a more complete description of my problem:
> >
> > I need to combine two kinds of matching in my sitemap, and so far 
>neither
> > the documentation or sample sitemap can tell me how to accomplish it.
>There
> > are _two conditions_ that my pipeline needs to meet, and I can't figure
>out
> > how to meet them both at once:
> >
> > 1) Parsing the URI into its components, which I use to determine both 
>the
> > data source (i.e. the url for the map:generate tag) and the particular
> > stylesheet that will get applied (the map:transform tag).
> > 2) Acquiring *all* of the request parameters appended to the path 
>portion
>of
> > the URI, and passing these parameters on as part of the URI for the
> > map:generate tag.  For example, a filtering form might specify
> > "subject=Goats", "location=Tucson" and
> > "dateStart=10-09-02&dateEnd=10-20-02".
> >
> > Here's a sample pipeline which just uses the wildcard URI matcher:
> > ----------- Code snip ----------------------
> >    <map:match pattern="*/*/*.*.html*">
> >        <map:generate type="file"
> >
>src="http://localhost:8000/{1}/CalendarRegistry/{2}/EventCollection/getCatal
>oguedEventsAsXML"/>
> >        <map:transform
> >
>src="http://localhost:8080/mightycal/{1}/{2}/{3}/intermediate-to-html.{4}.xs
>l"/>
> >        <map:serialize/>
> >    </map:match>
> > ------------ End code snip -----------------
> >
> > To add one of the request parameters, I could wrap the above <map:match>
>tag
> > in another matcher, e.g.: <map:match pattern="filter"
> > type="request-parameter">.  The problem with this solution is that it 
>only
> > gets me *one* of the potentially five or six parameters that might be
>passed
> > as part of the request.  Do I have to wrap this matcher inside  a 
>separate
> > matcher for each parameter, so that I end up with a matcher structure 
>that
> > is 6 levels deep?  That seems crazy.  It also doesn't allow for 
>situations
> > where only *some* of the parameters are present, and not others.
> >
> > What would work best is a matcher or other mechanism that would clump 
>all
>of
> > the request parameters together in a single sstring, which I could then
> > append to the main <map:generate> component of my pipeline.
> >
> > Can this be done with the existing matchers?  Do I have to use actions?
>Or
> > do I have to write my own custom matcher?
> >
> > Thanks in advance for advice.
> >
> > Erik Norvelle
> > ==================================================================
> > Support Systems Analyst
> > College of Agriculture and Life Sciences
> > The University of Arizona
> >
> >
> >
> >
> > _________________________________________________________________
> > Send and receive Hotmail on your mobile device: http://mobile.msn.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:     <cocoon-users-unsubscribe@xml.apache.org>
> > For additional commands, e-mail:   <cocoon-users-help@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:     <cocoon-users-unsubscribe@xml.apache.org>
>For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>

_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.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:     <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>


Mime
View raw message