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.  

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.

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.

Thanks,
Steve


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


That is precisely why I posted it before submitting a patch ;-)  I have 
nothing that uses your scenario.  You do :-)

Ditlinger, Steve wrote:

>Eddie:
>
>Looks like it will do the trick.  Please let me test it out and perhaps add
>a refinement. 
>
>Please stand by....
>
>Thanks,
>Steve
>
>-----Original Message-----
>From: Eddie Bush [mailto:[EMAIL PROTECTED]]
>Sent: Thursday, September 26, 2002 11:05 PM
>To: Struts Developers List
>Cc: Ditlinger, Steve; [EMAIL PROTECTED]
>Subject: Re: [sub-app] Default Module
>
>
>See attachment.  Would you find these refactorings sufficient?  If so, 
>I'll attach it to the bug.  I *think* this will appease everyone's
interest.
>
>(Steve and Malani:  See post by Martin Cooper on struts-dev for background)
>

-- 
Eddie Bush



Attachment: RequestUtils.selectApplication.java
Description: Binary data

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

Reply via email to