I'm looking at this code again. Does Route.expand really need to take a Context? It seems like all it should ever really need is a Map.

James - thoughts?
- Dan

Jim Ancona (JIRA) wrote:
    [ https://issues.apache.org/jira/browse/ABDERA-95?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12564498#action_12564498 ] 

Jim Ancona commented on ABDERA-95:
----------------------------------

The problem with my fix is that the third parameter to RouteManager.urlFor() is an Object and my fix only handles the case where it is a Map. If you look at RouteManager.getContext(), you'll see that it handles two other cases (Contaxt and Object). I couldn't see  a general way to add the extra parameters to the Context. (Contexts don't even have the equivalent of Map.getKeys(), so you can't find out what in them in order to merge them.) My code will work in the current case, but would fail if a caller passed something other than a Map to RouteManager.urlFor() .

This look to me to be better than the servicesPattern approach. I had tried an approach using code that I wrote to parse a URI according to a URI template, but as James said, you can't do it in the general case, and besides the Principle of Least Power[1] applies: Routes are less powerful than templates but still solve the problem cleanly and therefore are more desirable in this case.

[1] - http://www.w3.org/2001/tag/doc/leastPower.html

  
DefaultProvider doesn't properly handle parameters in base routes
-----------------------------------------------------------------

                Key: ABDERA-95
                URL: https://issues.apache.org/jira/browse/ABDERA-95
            Project: Abdera
         Issue Type: Bug
           Reporter: Jim Ancona
        Attachments: CustomerAdapterTest.patch, RouteManager_workaround.patch


I spent some time trying to debug this last night, but didn't find the solution. I will attach a unit test patch that reproduces the problem.
    

  


-- 
Dan Diephouse
MuleSource
http://mulesource.com | http://netzooid.com/blog

Reply via email to