Hi Sergey,
I think it will be slightly complicated to describe the logic in a
short sentense.
As I see, we need to make sure the matching works for the following cases.

Suppose we have the registered services at
"/soap", "/soap2", "/soappath", "/soap/test".

we should have the matching match(address) -> the registered path with

match("/soap") -> "/soap"
match("/soap/2") -> "/soap"
match("/soap/") -> "/soap"
match("/soap2") -> "/soap2"
match("/soap3") -> null
match("/soap/test") -> "/soap/test"
match("/soap/tst") -> "/soap"

Basically, we need to check if the address is identical to the path or
starts with the path + "/".
A special case is when the address ends with an "/" as in the third
case above, which needs to be matched against the path using only the
part preceeding to the "/".

I'll create a jira ticket and suggest a possible solution.

In addition, we might still need an exact matching option if people
are not happy with the call to "/soap/test" suddenly forwarded to
"/soap" as in the last case intead of getting rejected when we
unregister the service at "/soap/test". Or is this behavior accepted
or even expected? I think we can live with this behavior, but I am not
sure what others think.

regards, aki

2011/5/11 Sergey Beryozkin <[email protected]>:
>>
>> Aki, in the code you posted,
>>
>> for (String path : getDestinationsPaths()) {
>>           if (address.startsWith(path)
>>               && path.length() > len) {
>>               ret = getDestinationForPath(path);
>>               len = path.length();
>>           }
>>       }
>>
>> It should probably be just
>>
>> if (path.startsWith(adddress)
>>
>> That will make sure /soapaddress destinations won't catch
>> /soapaddress2 requests but will /soapaddress/1.
>>
> Sorry, I got confused, the above suggestion is also incorrect :-).
>
> Given /soapaddress2 and destination address /soapaddress,
> path.startsWith(adddress) would fix it but we'd get /soapaddress
> delivered to /soapaddress2 destinations, so as you suggested, the
> address (/soapaddress2 or /soapaddress2/2) has to be split into
> segments and the first segment needs to match exactly the endpoint
> address, that should probably work, what do you think ?
>
> thanks, Sergey
>

Reply via email to