cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From SAXESS - Hussayn Dabbous <>
Subject enhancement of RequestParamAction
Date Tue, 11 Feb 2003 11:16:18 GMT
Hy, all;

i had a problem with RequestParamAction (cocoon-2.0.4). I enclose
the Source of a slightly modified version of RequestParamAction
that solves my problem. The class is named ExtendedRequestParamAction,
i did a little of refactoring and a bit on the documentation
of the class. In case it makes sense, i would be glad if someone
could replace the body of RequestParamAction with the body of my
modified class, which is fully compatible to the original.
(I don't know how to apply a patch myself ...)

In the following i explain, why i made the modifications:

The problem:

I want to use the requestQuery of an incoming request in my sitemap
as follows:

<map:match pattern="*/canvas/search_mask">
   <map:act type="request" >
     <map:parameter name="default.fieldtype" value="required"/>
     <map:generate src="http:/hmyserver/result{requestQuery}"/>
   <map:serialize type = "xml"/>

This would forward the GET parameters of the original request to the 
HTTP call for the src in map:generate.
In addition i want to forward the parameter fieldtype. How would i do
this with RequestParamAction ?

The RequestParamAction can't help me there because:

1.) It won't add the fieldtype to the requestQuery automatically.
     so i must add it myself, e.g. like this:


     This fails, if {requestQuery} happens to be empty. Due to the
     treatment of requestQuery in the code i would miss the
     beginning "?" of my querylist in that case.


     wouldn't work either. In this case i would end with duplicate "?",
     if requestQuery is NOT empty.

2.) I could use the parameters="true":

     <map:act type="request" >
       <map:parameter name="default.fieldtype" value="required"/>
       <map:parameter name="parameters" value="true"/>
       <map:generate ...

      Then i need to know exactly, which parameters are given in the
      original request and i would need to specify each parameter
      in the sitemap, which i don't want (i even don't know, which
      parameters are enclosed in the list).

the solution

In order to get around this problem i added a new parameter named
"usedefaults". If this parameter is given in the sitemap, then
all default parameters, which are not allready set in the query are
automatically added to the requestQuery string.

By this i can now setup my sitemap as follows:

<map:match pattern="*/canvas/search_mask">
   <map:act type="request" >
     <map:parameter name="usedefault" value="true"/>
     <map:parameter name="default.fieldtype" value="required"/>
     <map:generate src="http:/hmyserver/result.jsp{requestQuery}"/>
   <map:serialize type = "xml"/>

and i am shure, fieldtype is enclosed in the requestQuery, either
from the request itself, or added by the action.


default parameters are always added after the original queryString,
hence i have no control of the insertion place in the queryList. This
may be necessary in some pathological cases.

regards, Hussayn

View raw message