[PROPOSAL] Wildcard-matched actions

2003-06-30 Thread Don Brown
Perhaps now that 1.1 is final, this would be a good time to bring this up.
I've written a small extension to Struts that allows action mappings to
use wildcards in matching URIs.  The matched values can then be
substituted anywhere in the action mapping - similar to how Cocoon
operates (in fact the wildcard code was copied from Cocoon).  The code
only affects the processActionMapping method of the RequestProcessor.

Why you ask?

 - Much smaller config files
 - Use of wildcards encourages more consistency of naming action forms,
actions, and jsp files.
 - Allows for noun-based URLs in addition to current verb-based URLS,
particularly useful in REST-style web services
 - No performance loss: wildcard matching only occurs when a direct
mapping for the URI cannot be found

For example:



  
  


By including this feature directly in Struts, wildcards would be available
to all Struts applications as opposed to now where wildcard support
requires a RequestProcessor extension.

For more information:

http://www.twdata.org/struts-wildcard/

Don


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [PROPOSAL] Wildcard-matched actions

2003-07-04 Thread Niall Pemberton
I like it.

Perhaps you should create an enhancement request in bugzilla and attach a
patch with your code.

Niall


- Original Message - 
From: "Don Brown" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 30, 2003 11:18 PM
Subject: [PROPOSAL] Wildcard-matched actions


> Perhaps now that 1.1 is final, this would be a good time to bring this up.
> I've written a small extension to Struts that allows action mappings to
> use wildcards in matching URIs.  The matched values can then be
> substituted anywhere in the action mapping - similar to how Cocoon
> operates (in fact the wildcard code was copied from Cocoon).  The code
> only affects the processActionMapping method of the RequestProcessor.
>
> Why you ask?
>
>  - Much smaller config files
>  - Use of wildcards encourages more consistency of naming action forms,
> actions, and jsp files.
>  - Allows for noun-based URLs in addition to current verb-based URLS,
> particularly useful in REST-style web services
>  - No performance loss: wildcard matching only occurs when a direct
> mapping for the URI cannot be found
>
> For example:
>
> 
> type="org.apache.struts.webapp.example.Edit{1}Action"
>   attribute="{1}Form"
>   scope="request"
>validate="false">
>   
>   
> 
>
> By including this feature directly in Struts, wildcards would be available
> to all Struts applications as opposed to now where wildcard support
> requires a RequestProcessor extension.
>
> For more information:
>
> http://www.twdata.org/struts-wildcard/
>
> Don
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [PROPOSAL] Wildcard-matched actions

2003-07-05 Thread Craig R. McClanahan


On Sat, 5 Jul 2003, Niall Pemberton wrote:

> Date: Sat, 5 Jul 2003 01:32:45 +0100
> From: Niall Pemberton <[EMAIL PROTECTED]>
> Reply-To: Struts Developers List <[EMAIL PROTECTED]>
> To: Struts Developers List <[EMAIL PROTECTED]>
> Subject: Re: [PROPOSAL] Wildcard-matched actions
>
> I like it.
>
> Perhaps you should create an enhancement request in bugzilla and attach a
> patch with your code.

The idea makes some sense, and gets us more towards a general purpose
"site map" approach to mapping arbitrary URLs to arbitrary actions.  My
one concern will be performance related, since this kind of matching will
be slower than the existing approach.  This could perhaps be alleviated by
having a per-module-setting (or some smart initialization code) that only
used the wildcard matching code if the module actually has some actions
that need it, and uses the optimized version otherwise.

>
> Niall

Craig

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [PROPOSAL] Wildcard-matched actions

2003-07-05 Thread Don Brown
Actually, the way I wrote the code, wildcards are only matched if an exact 
match cannot be found but before the "unknown" action mapping is executed.  
So, there is no performance penalty for existing applications that use 
specific matchings.  The order:

 - Try to find an action mapping that matches the path exactly
 - Try to find an action mapping using wildcard matching
 - Try to locate the mapping for "unknown" paths

Don



On Saturday 05 July 2003 08:31 am, Craig R. McClanahan wrote:
> On Sat, 5 Jul 2003, Niall Pemberton wrote:
> > Date: Sat, 5 Jul 2003 01:32:45 +0100
> > From: Niall Pemberton <[EMAIL PROTECTED]>
> > Reply-To: Struts Developers List <[EMAIL PROTECTED]>
> > To: Struts Developers List <[EMAIL PROTECTED]>
> > Subject: Re: [PROPOSAL] Wildcard-matched actions
> >
> > I like it.
> >
> > Perhaps you should create an enhancement request in bugzilla and attach a
> > patch with your code.
>
> The idea makes some sense, and gets us more towards a general purpose
> "site map" approach to mapping arbitrary URLs to arbitrary actions.  My
> one concern will be performance related, since this kind of matching will
> be slower than the existing approach.  This could perhaps be alleviated by
> having a per-module-setting (or some smart initialization code) that only
> used the wildcard matching code if the module actually has some actions
> that need it, and uses the optimized version otherwise.
>
> > Niall
>
> Craig
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [PROPOSAL] Wildcard-matched actions

2003-07-05 Thread Don Brown
And I forgot to mention, when using the wildcard matcher, only action mappings 
that actually contain wildcards will be tested.

Don

On Saturday 05 July 2003 01:18 pm, Don Brown wrote:
> Actually, the way I wrote the code, wildcards are only matched if an exact
> match cannot be found but before the "unknown" action mapping is executed.
> So, there is no performance penalty for existing applications that use
> specific matchings.  The order:
>
>  - Try to find an action mapping that matches the path exactly
>  - Try to find an action mapping using wildcard matching
>  - Try to locate the mapping for "unknown" paths
>
> Don
>
> On Saturday 05 July 2003 08:31 am, Craig R. McClanahan wrote:
> > On Sat, 5 Jul 2003, Niall Pemberton wrote:
> > > Date: Sat, 5 Jul 2003 01:32:45 +0100
> > > From: Niall Pemberton <[EMAIL PROTECTED]>
> > > Reply-To: Struts Developers List <[EMAIL PROTECTED]>
> > > To: Struts Developers List <[EMAIL PROTECTED]>
> > > Subject: Re: [PROPOSAL] Wildcard-matched actions
> > >
> > > I like it.
> > >
> > > Perhaps you should create an enhancement request in bugzilla and attach
> > > a patch with your code.
> >
> > The idea makes some sense, and gets us more towards a general purpose
> > "site map" approach to mapping arbitrary URLs to arbitrary actions.  My
> > one concern will be performance related, since this kind of matching will
> > be slower than the existing approach.  This could perhaps be alleviated
> > by having a per-module-setting (or some smart initialization code) that
> > only used the wildcard matching code if the module actually has some
> > actions that need it, and uses the optimized version otherwise.
> >
> > > Niall
> >
> > Craig
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [PROPOSAL] Wildcard-matched actions

2003-07-05 Thread Graham Leggett
Don Brown wrote:

Perhaps now that 1.1 is final, this would be a good time to bring this up.
I've written a small extension to Struts that allows action mappings to
use wildcards in matching URIs.
I submitted a patch to bugzilla a while back that did prefix matching in 
matching URIs. A config called "foo" could be called, regardless of 
whether it was accessed as "/bar/foo", or "/fred/foo". Very useful for 
standard functionality that is reused in a site, such as a login form. 
We've been using it for a while, and it works great.

Wildcard matching would also be really useful.

Regards,
Graham
--
-
[EMAIL PROTECTED]   "There's a moon
over Bourbon Street
tonight..."
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: [PROPOSAL] Wildcard-matched actions

2003-07-06 Thread Ted Husted
Graham,

I don't see that ticket on the current patch list:

http://issues.apache.org/bugzilla/buglist.cgi?bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=VERIFIED&email1=&emailtype1=substring&emailassigned_to1=1&email2=&emailtype2=substring&emailreporter2=1&bugidtype=include&bug_id=&changedin=&votes=&chfieldfrom=&chfieldto=Now&chfieldvalue=&product=Struts&short_desc=&short_desc_type=allwordssubstr&long_desc=&long_desc_type=allwordssubstr&bug_file_loc=&bug_file_loc_type=allwordssubstr&keywords=PatchAvailable&keywords_type=anywords&field0-0-0=noop&type0-0-0=noop&value0-0-0=&cmdtype=doit&newqueryname=&order=Bug+Number

[Select all status but RESOLVED and CLOSED, select Struts, enter 
"PatchAvailable" in keyword.]

do you have the ticket number?

Don,

Would your patch interact with

http://issues.apache.org/bugzilla/show_bug.cgi?id=15921

-Ted.

Graham Leggett wrote:
Don Brown wrote:

Perhaps now that 1.1 is final, this would be a good time to bring this 
up.
I've written a small extension to Struts that allows action mappings to
use wildcards in matching URIs.


I submitted a patch to bugzilla a while back that did prefix matching in 
matching URIs. A config called "foo" could be called, regardless of 
whether it was accessed as "/bar/foo", or "/fred/foo". Very useful for 
standard functionality that is reused in a site, such as a login form. 
We've been using it for a while, and it works great.

Wildcard matching would also be really useful.

Regards,
Graham


--
Ted Husted,
Struts in Action 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: [PROPOSAL] Wildcard-matched actions

2003-07-06 Thread Don Brown
On Sunday 06 July 2003 02:12 am, Ted Husted wrote:

> Don,
>
> Would your patch interact with
>
> http://issues.apache.org/bugzilla/show_bug.cgi?id=15921

I don't see why not.  My patch inserts a few lines in processMapping which 
calls a helper class that runs through all the action configs, matches one, 
clones it and replaces wildcard values with the literal values, and returns 
the new clone.  

I'll put the code in patch form and post it on bugzilla.

Don

>
>
> -Ted.
>
> Graham Leggett wrote:
> > Don Brown wrote:
> >> Perhaps now that 1.1 is final, this would be a good time to bring this
> >> up.
> >> I've written a small extension to Struts that allows action mappings to
> >> use wildcards in matching URIs.
> >
> > I submitted a patch to bugzilla a while back that did prefix matching in
> > matching URIs. A config called "foo" could be called, regardless of
> > whether it was accessed as "/bar/foo", or "/fred/foo". Very useful for
> > standard functionality that is reused in a site, such as a login form.
> > We've been using it for a while, and it works great.
> >
> > Wildcard matching would also be really useful.
> >
> > Regards,
> > Graham


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]