You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Eric Shannon <es...@careersite.com> on 2005/03/01 23:30:04 UTC

Using patterns for map:act elements ??

In an effort to reduce the number of match patterns in my sitemap, I 
have a desire to dynamically set the action handler.

I had hopped to find that map:act types support variable  substitution, 
but that appears to not be the case.


For example, I would want a URL like: 
http://localhost:8080/myApp/form1.do  to use a generic match pattern 
like below.

Define:   <map:action name="process-form1" src="ProcessForm"/>

Then have a generic match pattern like so:
<map:match pattern="*.do">
    <map:act type="process-{1}">  //It would appear that this is NOT an 
option.
    .......
</map:match>

Any ideas on how generalize 100+ specific actions?

I could have a factory that creates/manages the actions internally and 
basically define one action handler in the pipeline that utilizes my 
factory.  I would think that this isn't a unique use case.

Input is appreciated.

-Eric



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


Re: Using patterns for map:act elements ??

Posted by Jorg Heymans <jh...@domek.be>.
Eric Shannon wrote:
> The projects is using Cocoon 2.1.5.1.  This implementation is something 
> I am currently "inheriting".  I had used Cocoon 2.0.x some time ago, so 
> their action based approach didn't strike me as too off the wall.  It is 
> quite the mess to manage though.
> 
> What is the common approach to solving this?

Have a look at http://marc.theaimsgroup.com/?t=107590406800001&r=1&w=2 
as to why exactly it is not allowed to have dynamic type attributes.

I know i'm still not answering your question :).

IMO you will probably need to do some structural changes to your 
application if you want to reduce it. Maybe one way to go about it is to 
use flow, so you could do write like
<map:match pattern="*.do">
   <map:call function="public_{1}"/>
</map:match>

whereby each flow function would take over the logic of your action and 
redirect back to the sitemap.


HTH
Jorg


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


Re: Using patterns for map:act elements ??

Posted by Eric Shannon <es...@careersite.com>.
The projects is using Cocoon 2.1.5.1.  This implementation is something 
I am currently "inheriting".  I had used Cocoon 2.0.x some time ago, so 
their action based approach didn't strike me as too off the wall.  It is 
quite the mess to manage though.

What is the common approach to solving this?

Thanks - Eric

Jorg Heymans wrote:

>
>
> Eric Shannon wrote:
>
>> In an effort to reduce the number of match patterns in my sitemap, I 
>> have a desire to dynamically set the action handler.
>>
>> I had hopped to find that map:act types support variable  
>> substitution, but that appears to not be the case.
>>
>>
>> For example, I would want a URL like: 
>> http://localhost:8080/myApp/form1.do  to use a generic match pattern 
>> like below.
>>
>> Define:   <map:action name="process-form1" src="ProcessForm"/>
>>
>> Then have a generic match pattern like so:
>> <map:match pattern="*.do">
>>    <map:act type="process-{1}">  //It would appear that this is NOT 
>> an option.
>>    .......
>> </map:match>
>>
>> Any ideas on how generalize 100+ specific actions?
>
>
> This isn't the answer you were hoping for but: Why are you coding 
> everything up in actions ? Are you still using 2.0.x perhaps?
>
>
> Jorg
>
>
> ---------------------------------------------------------------------
> 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: Using patterns for map:act elements ??

Posted by Jorg Heymans <jh...@domek.be>.

Eric Shannon wrote:
> In an effort to reduce the number of match patterns in my sitemap, I 
> have a desire to dynamically set the action handler.
> 
> I had hopped to find that map:act types support variable  substitution, 
> but that appears to not be the case.
> 
> 
> For example, I would want a URL like: 
> http://localhost:8080/myApp/form1.do  to use a generic match pattern 
> like below.
> 
> Define:   <map:action name="process-form1" src="ProcessForm"/>
> 
> Then have a generic match pattern like so:
> <map:match pattern="*.do">
>    <map:act type="process-{1}">  //It would appear that this is NOT an 
> option.
>    .......
> </map:match>
> 
> Any ideas on how generalize 100+ specific actions?

This isn't the answer you were hoping for but: Why are you coding 
everything up in actions ? Are you still using 2.0.x perhaps?


Jorg


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