Return-Path: Delivered-To: apmail-incubator-abdera-dev-archive@locus.apache.org Received: (qmail 406 invoked from network); 16 May 2008 16:48:19 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 16 May 2008 16:48:19 -0000 Received: (qmail 29865 invoked by uid 500); 16 May 2008 16:48:21 -0000 Delivered-To: apmail-incubator-abdera-dev-archive@incubator.apache.org Received: (qmail 29847 invoked by uid 500); 16 May 2008 16:48:21 -0000 Mailing-List: contact abdera-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: abdera-dev@incubator.apache.org Delivered-To: mailing list abdera-dev@incubator.apache.org Received: (qmail 29836 invoked by uid 99); 16 May 2008 16:48:21 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 May 2008 09:48:21 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of david.primmer@gmail.com designates 209.85.146.176 as permitted sender) Received: from [209.85.146.176] (HELO wa-out-1112.google.com) (209.85.146.176) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 May 2008 16:47:33 +0000 Received: by wa-out-1112.google.com with SMTP id m16so302480waf.6 for ; Fri, 16 May 2008 09:47:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=+mP7+RWXt9hbiIcj8dGCTH5oRdTBGDc58ESYf6Skbc4=; b=mVOUdI+6wsZ6rw/mVLuyXXqWedN0eE3ZorR3cQo5gOfq8uLcH3y1pcjXhg345UqQ9PUnP2YVQBnVkw+A9dp96Nc3iL3M6/x0I/z4ryCTJ/Gvjc8irIsoNRrzELlAmDvksuYA4cetlxTAZT/hTNhszq9Zmvfn7wO7nyMxCYWu1Bc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=nzI1I+/eCkx7YtzIoprt5yg3NfiSO9ewIGg+cxDR4Lx4aZkNEBUKGHiEv42WBU3A12PemiWEeF0zt8wt57hy5Hx9o1nWysn4scnPK1OXQqCobhkc344WJc3g6xN4SdQaGyYCig4ByH//ZFe3C/O1lVqTKypdnkhGDfenvY+O5AQ= Received: by 10.115.110.6 with SMTP id n6mr3933243wam.92.1210956467626; Fri, 16 May 2008 09:47:47 -0700 (PDT) Received: by 10.114.126.18 with HTTP; Fri, 16 May 2008 09:47:47 -0700 (PDT) Message-ID: Date: Fri, 16 May 2008 09:47:47 -0700 From: "David Primmer" To: abdera-dev@incubator.apache.org Subject: Re: urlFor in RouteManager does not let you null out vars In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <482C5216.4030809@gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org I'm on svn head... actually the last repo push by dan a few days ago. I'll take a look at the patch. On Fri, May 16, 2008 at 1:41 AM, David Calavera wrote: > David, what abdera version are you using? can you include one of your test > cases? I'm trying to fix it but I don't have the same results. > > On Fri, May 16, 2008 at 12:12 AM, David Primmer > wrote: > >> I just tested another use case, for the situation where I'm sending in >> a map with a nulled out param 'id=null' and in this case, I have send >> a request with query params '/feed/1?format=atom' and in this case, >> when it builds the link, it actually adds '?id=' onto the end of the >> url that is created so '/feed/?id='. So this seems to get complicated >> if there are query params already in the request context. >> >> davep >> >> On Thu, May 15, 2008 at 2:10 PM, David Primmer >> wrote: >> > I was thinking that if you passed in null, the urlFor would not >> > replace any of your tokens. But on the other hand, this behavior lets >> > you get a url by just sending in one arg: the route name. >> > >> > I'm not sure off the top of my head how the Ruby and Python Routes >> > libs handle this. It is hard to know what users would expect but at a >> > minimum it should be in a code comment. As it is, if I have two tokens >> > in my route and I only one one of them to be replaced with the request >> > var, i can get this by sending in a map with only one of the params >> > set to null for the one i don't want and the other one will magically >> > get resolved. Seems a little to implicit to me. >> > >> > davep >> > >> > On Thu, May 15, 2008 at 2:02 PM, David Calavera >> > wrote: >> >> Hi David, what do you think could be the expected behavior? >> >> >> >> On Thu, May 15, 2008 at 5:09 PM, James M Snell >> wrote: >> >> >> >>> Ok, we need to fix that. Want to open a jira issue? >> >>> >> >>> - James >> >>> >> >>> >> >>> David Primmer wrote: >> >>> >> >>>> I need to correct myself here. After investigating the code more, I >> >>>> was able to get the result I wanted by sending in a map with id=null >> >>>> as params instead of sending in a null param arg. The code only pulls >> >>>> in values from the request if they're not explicitly included in the >> >>>> params map in urlFor. I still don't know if this is the desired >> >>>> behavior. It's certainly not what I expected. >> >>>> >> >>>> davep >> >>>> >> >>>> On Wed, May 14, 2008 at 11:21 AM, David Primmer < >> david.primmer@gmail.com> >> >>>> wrote: >> >>>> >> >>>>> I'm trying to implement getHref in an adapter, which returns the url >> >>>>> for the collection. I'm also using RouteManager and it's urlfor >> >>>>> >> >>>>> for (String var : route.getVariables()) { >> >>>>> Object value = context.getTarget().getParameter(var); >> >>>>> if (!map.containsKey(var) && value != null) { >> >>>>> map.put(var, value); >> >>>>> } >> >>>>> } >> >>>>> >> >>>>> say my route is /feed/:id >> >>>>> and my request is /feed/1 >> >>>>> >> >>>>> if i'm doing urlFor("myroute", null), hoping that it produces /feed/ >> >>>>> as a url, but instead, the code above pulls the id out of the request >> >>>>> context and fills in those params, giving me a url of /feed/1. I >> don't >> >>>>> understand why it would do this and it limits the use of urlFor for >> >>>>> generating collection urls. >> >>>>> >> >>>>> davep >> >>>>> >> >>>>> >> >>>> >> >> >> >> >> >> -- >> >> David Calavera >> >> http://www.thinkincode.net >> >> >> > >> > > > > -- > David Calavera > http://www.thinkincode.net >