Hi Miyuru,
Our uri template implementation do not not cover all scenarios mentioned in
uri-template specification. But according to uri-template
spec<http://tools.ietf.org/html/rfc6570#section-1.2> there
is no such explanation(like /{var} maps to /variable/ ). But in general
having / at the end of url is not an issue. What do you think?

Thanks,
Sanjeewa.

On Wed, Apr 24, 2013 at 12:43 PM, Miyuru Wanninayaka <[email protected]>wrote:

> AFIU trailing / of a uri should not cause a issue and need to ignore
>
> /dictionary/d/dog/ == /dictionary/d/dog
>
>
> On Wed, Apr 24, 2013 at 12:34 PM, Sanjeewa Malalgoda <[email protected]>wrote:
>
>> Hi Miyuru,
>> AFAIU  resource.setDispatcherHelper(new
>> URITemplateHelper("/dictionary/{char}/{word}")); means url should end with
>> variable named word(cannot have / at the end). If we need to
>> match "/dictionary/d/dog/" template definition should
>> be "/dictionary/{char}/{word}/". Did i missed something here?
>>
>> Thanks.
>> Sanjeewa.
>>
>>
>> On Wed, Apr 24, 2013 at 12:19 PM, Miyuru Wanninayaka <[email protected]>wrote:
>>
>>> Hi Sanjeewa,
>>>
>>> This cause a test fail in synapse URITemplateBasedDispatcherTest
>>>
>>>  resource.setDispatcherHelper(new
>>> URITemplateHelper("/dictionary/{char}/{word}"));
>>> does not accept
>>>
>>> synCtx = getMessageContext(synapseConfig, false, "/dictionary/d/dog/",
>>> "GET");
>>>
>>> Note and training /
>>>
>>>
>>> ---------- Forwarded message ----------
>>> From: <[email protected]>
>>> Date: Fri, Jan 11, 2013 at 2:06 PM
>>> Subject: [Commits] [Carbon-platform] svn commit r153055 - in
>>> carbon/platform/branches/4.0.0/dependencies/commons/uri-templates/1.6.3/src/main/java/org/wso2/uri/template:
>>> . parser
>>> To: [email protected]
>>>
>>>
>>> Author: sanjeewa
>>> Date: Fri Jan 11 14:06:54 2013
>>> New Revision: 153055
>>> URL: http://wso2.org/svn/browse/wso2?view=rev&revision=153055
>>>
>>> Log:
>>> adding improvements for uri template
>>>
>>> Modified:
>>>
>>>  
>>> carbon/platform/branches/4.0.0/dependencies/commons/uri-templates/1.6.3/src/main/java/org/wso2/uri/template/URITemplate.java
>>>
>>>  
>>> carbon/platform/branches/4.0.0/dependencies/commons/uri-templates/1.6.3/src/main/java/org/wso2/uri/template/parser/Node.java
>>>
>>> Modified:
>>> carbon/platform/branches/4.0.0/dependencies/commons/uri-templates/1.6.3/src/main/java/org/wso2/uri/template/URITemplate.java
>>> URL:
>>> http://wso2.org/svn/browse/wso2/carbon/platform/branches/4.0.0/dependencies/commons/uri-templates/1.6.3/src/main/java/org/wso2/uri/template/URITemplate.java?rev=153055&r1=153054&r2=153055&view=diff
>>>
>>> ==============================================================================
>>> ---
>>> carbon/platform/branches/4.0.0/dependencies/commons/uri-templates/1.6.3/src/main/java/org/wso2/uri/template/URITemplate.java
>>>        (original)
>>> +++
>>> carbon/platform/branches/4.0.0/dependencies/commons/uri-templates/1.6.3/src/main/java/org/wso2/uri/template/URITemplate.java
>>>        Fri Jan 11 14:06:54 2013
>>> @@ -40,9 +40,9 @@
>>>      }
>>>
>>>      public boolean matches(String uri, Map<String,String> variables) {
>>> -        if (uri.endsWith("/") && uri.length() > 1) {
>>> +        /* if (uri.endsWith("/") && uri.length() > 1) {
>>>              uri = uri.substring(0, uri.length() - 1);
>>> -        }
>>> +        }*/
>>>          return syntaxTree.matchAll(uri, variables) == uri.length();
>>>      }
>>>  }
>>>
>>> Modified:
>>> carbon/platform/branches/4.0.0/dependencies/commons/uri-templates/1.6.3/src/main/java/org/wso2/uri/template/parser/Node.java
>>> URL:
>>> http://wso2.org/svn/browse/wso2/carbon/platform/branches/4.0.0/dependencies/commons/uri-templates/1.6.3/src/main/java/org/wso2/uri/template/parser/Node.java?rev=153055&r1=153054&r2=153055&view=diff
>>>
>>> ==============================================================================
>>> ---
>>> carbon/platform/branches/4.0.0/dependencies/commons/uri-templates/1.6.3/src/main/java/org/wso2/uri/template/parser/Node.java
>>>        (original)
>>> +++
>>> carbon/platform/branches/4.0.0/dependencies/commons/uri-templates/1.6.3/src/main/java/org/wso2/uri/template/parser/Node.java
>>>        Fri Jan 11 14:06:54 2013
>>> @@ -54,7 +54,8 @@
>>>              } else {
>>>                  // We have more content in the URI to match
>>>                  // But there aren't any nodes left to match against
>>> -                return -1;
>>> +                // return -1;
>>> +                return matchLength;
>>>              }
>>>          } else if (matchLength == uriFragment.length() && next != null)
>>> {
>>>              // We have matched all the characters in the URI
>>> _______________________________________________
>>> Commits mailing list
>>> [email protected]
>>> http://wso2.org/cgi-bin/mailman/listinfo/commits
>>>
>>>
>>>
>>> --
>>> Miyuru Wanninayaka
>>> Senior Software Engineer - WSO2 Inc
>>> +94-772099788
>>
>>
>>
>>
>> --
>> *Sanjeewa Malalgoda*
>> WSO2 Inc.
>> Mobile : +14084122175 | +94713068779
>>
>>  <http://sanjeewamalalgoda.blogspot.com/>blog
>> :http://sanjeewamalalgoda.blogspot.com/<http://sanjeewamalalgoda.blogspot.com/>
>>
>
>
>
> --
> Miyuru Wanninayaka
> Senior Software Engineer - WSO2 Inc
> +94-772099788
>



-- 
*Sanjeewa Malalgoda*
WSO2 Inc.
Mobile : +14084122175 | +94713068779

 <http://sanjeewamalalgoda.blogspot.com/>blog
:http://sanjeewamalalgoda.blogspot.com/<http://sanjeewamalalgoda.blogspot.com/>
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to