abdera-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Diephouse <dan.diepho...@mulesource.com>
Subject Route.expand (was Re: [jira] Commented: (ABDERA-95) DefaultProvider doesn't properly handle parameters in base routes)
Date Thu, 31 Jan 2008 20:56:28 GMT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  <meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
<body bgcolor="#ffffff" text="#000000">
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.<br>
James - thoughts?<br>
- Dan<br>
Jim Ancona (JIRA) wrote:
<blockquote cite="mid:14121376.1201812548386.JavaMail.jira@brutus"
  <pre wrap="">    [ <a class="moz-txt-link-freetext" href="https://issues.apache.org/jira/browse/ABDERA-95?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12564498#action_12564498">https://issues.apache.org/jira/browse/ABDERA-95?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&amp;focusedCommentId=12564498#action_12564498</a>

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] - <a class="moz-txt-link-freetext" href="http://www.w3.org/2001/tag/doc/leastPower.html">http://www.w3.org/2001/tag/doc/leastPower.html</a>

  <blockquote type="cite">
    <pre wrap="">DefaultProvider doesn't properly handle parameters in base routes

                Key: ABDERA-95
                URL: <a class="moz-txt-link-freetext" href="https://issues.apache.org/jira/browse/ABDERA-95">https://issues.apache.org/jira/browse/ABDERA-95</a>
            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.
  <pre wrap=""><!---->
<pre class="moz-signature" cols="72">-- 
Dan Diephouse
<a class="moz-txt-link-freetext" href="http://mulesource.com">http://mulesource.com</a>
| <a class="moz-txt-link-freetext" href="http://netzooid.com/blog">http://netzooid.com/blog</a></pre>

View raw message