Hi Vincent,

Here is the official structure of a generic URI:

        URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]

So, as we define patterns on the hierarchical part, the question mark is not
considered. To come back to your initial question, instead of defining:

    attach("/accounts/[0-9]+$", new GetAccountHandler())
    attach("/accounts?[.]+$", new SearchAccountHandler())

You could define:

    attach("/accounts/[0-9]+$", new GetAccountHandler())
    attach("/accounts$", new SearchAccountHandler())

Actually, even this should work as we select the route that matches the
largest percentage of characters in each pattern:

    attach("/accounts/[0-9]", new GetAccountHandler())
    attach("/accounts", new SearchAccountHandler())

Doesn't that solve your problem?

Best regards,
Jerome  

> -----Message d'origine-----
> De : news [mailto:[EMAIL PROTECTED] De la part de Vincent
> Envoyé : dimanche 5 novembre 2006 19:50
> À : discuss@restlet.tigris.org
> Objet : Re: Handlers for search urls
> 
> Hi Jerome,
> 
> 
> > The choice of not exposing the query string and the 
> fragment part of the
> > target resource URI was deliberate.
> 
> The question is: is the question mark part of the query string?
> 
> > The reason is that the query string is often composed of a 
> sequence of
> > parameters ("key=value") that can appear in any order while 
> keeping the same
> > semantics.
> 
> Agreed. I wasn't trying to define a regexp on the request 
> parameters,  I was
> just interested in catching the question mark. I  wanted to 
> differentiate
> between '/accounts/123' and 'accounts?status=active'.
> It turns out that attach("/account/[0-9]+",..) and 
> attach("/accounts[.]+",...)
> does the trick, but attach("/accounts?[.]+",...") would have 
> been slightly more
> elegant.
> 
> -Vincent.
> 

Reply via email to