Indeed, let them hang themselves!  
Just to be clear though:  such a hanging offense could still be committed
with single level sub-app names in combo with multi-level action names.

Good job, Eddie.  Thanks for working on this and posting the solution.

Thanks,
Steve

-----Original Message-----
From: Eddie Bush [mailto:[EMAIL PROTECTED]]
Sent: Friday, September 27, 2002 2:26 PM
To: Ditlinger, Steve
Cc: Struts Developers List; Malani, Prakash
Subject: Re: [sub-app] Default Module


Ditlinger, Steve wrote:

>It does indeed do the trick.  And it avoids repeating a variation of the
>original bug by starting with the longest possible matchPath and working
>toward shorter matchPaths.  
>
>The one possible problem that people could come up with would arise in the
>following situations:
>
>Let's say I have a module named "/foo" and another named "/foo/bar", as
well
>as the default module of "".  Now let's say "/foo" defined an action named
>"/bar/baz", "/foo/bar" defined an action named "/baz", and the default
>module defined an action named "/foo/bar/baz".  A request now comes in for
>"/foo/bar/baz.do", which action is it requesting?  With this algorithm,
>"/baz" in "/foo/bar" will always be selected. 
>
>Take it another step, let's say "/foo/bar" does not define an action named
>"/baz".  Under this algorithm, the "/foo/bar" module will always be
selected
>and then the request will fail because there is no "/baz" action, even if
>the user was requesting the "/bar/baz" action under "/foo" or the
>"/foo/bar/baz" action in the default module.  
>
Let them hang themselves.  They should be shot for building such a 
contraption.  I think this is why (and I still believe this is true) 
Craig's original intent was for sub-apps to provide exactly *one* 
additional level.  I personally didn't want to begin to think about 
sub-apps having multiple levels simple because I really want to see 
module-inheritence come to be in the main distribution ... and having 
multi-leveled sub-apps could bring additional complications.  Still, 
having all modules inherit from the default sub-app would be a worthy 
goal - would erradicate a lot of unnecessary duplication.

>However, there is no way around this, unless we also search for action
names
>at the same time. Even then you wouldn't know for sure whether or not you
>were getting the action the user really requested.  This problem could
exist
>no matter how many levels of hierarchy you have in your modules (1-n). The
>conclusion is that if a developer wants to assign such
overlapping/confusing
>names to their modules and subapps, no amount of programming on the Struts
>side is going to be able to save them from themselves.
>
... and there's no way to search the actions :-)

>Good thinking, Eddie, thanks.
>
>FWIW, I tweaked your posting to consolidate the if-else and the enclosed
>do-while into a single while loop for compactness.  The result is attached.
>
Yes - I wrote that pretty late last night (knew it needed to be done, 
but I was quite exhausted).  I'll incorporate your changes, add you as 
an author (I added myself), and submit a diff.

>Thanks,
>Steve
>
Anytime :-) Nice to end this on a positive note ;-)

-- 
Eddie Bush



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

Reply via email to