Hi Adam,

You're welcome. Concerning your remark regarding the query string, you're
correct and that might require two mappings indeed. There is already a RFE
for this:
http://restlet.tigris.org/issues/show_bug.cgi?id=314

Best regards,
Jerome  

> -----Message d'origine-----
> De : Adam Taft [mailto:[EMAIL PROTECTED] 
> Envoyé : samedi 16 juin 2007 23:26
> À : [email protected]
> Objet : Re: Preventing Greedy URL Matching
> 
> Hi Jerome,
> 
> Cheers.  Thanks for the FAQ entry.  For whatever reason, I 
> couldn't see 
> the (now obvious) solution.
> 
>  From the FAQ:
> "Note that after doing this, your Router won't accept URI with query 
> strings going to this Resource."
> 
> Big bummer.  Maybe this could be a RFE.  Ie. strict matching 
> except for 
> the query string.
> 
> "To solve this, you can explicitely allow the query part in your URI 
> template:
> Route route = router.attach("/users/{user}?{query}", 
> UserResource.class);"
> 
> Won't this then _require_ a query string to be attached to 
> the URL?  Or 
> at least require the question mark?  In this case, you would need an 
> additional router.attach("/users/{user}") if you wanted the 
> query string 
> part to be optional?
> 
> Thanks again,
> 
> Adam
> 
> 
> 
> Jerome Louvel wrote:
> > Hi Adam,
> > 
> > This is indeed a frequently asked question, but it didn't 
> have a FAQ entry
> > yet :) So I just had to write it:
> > http://www.restlet.org/documentation/1.0/faq#24
> > 
> > Best regards,
> > Jerome  
> > 
> >> -----Message d'origine-----
> >> De : Adam Taft [mailto:[EMAIL PROTECTED] 
> >> Envoyé : samedi 16 juin 2007 02:16
> >> À : [email protected]
> >> Objet : Preventing Greedy URL Matching
> >>
> >> Hi,
> >>
> >> I'm sure this has got to be a FAQ for Restlet, so sorry in 
> >> advance for 
> >> such a simple question...
> >>
> >> I've got a restlet attached to an example URL like:
> >>
> >> /example/{id}/
> >>
> >> I want the library to return a 404 for URLs with anything 
> >> trailing.  Ie.
> >>
> >> /example/{id}/foo
> >> /example/{id}/whatever/xyz/blah...
> >>
> >> How can I make the matching more "strict" and thus not accept 
> >> the extra 
> >> path.  I can do this manually per request by looking at the 
> >> request.getResourceRef().getRemainingPart().  But it's 
> seems kind of 
> >> silly to have to do this on every request.  Seems like it would be 
> >> better a part of the Router matching or something.
> >>
> >> Thanks for any advice on this.
> >>
> >> By the way, getRemainingPart() returns an empty string for a 
> >> request to 
> >> /example/{id}/  I'm wondering if this shouldn't return 
> NULL instead.
> >>
> >> Related, getSegments() on the above returns: [example, $id, ] 
> >>  See the 
> >> extra item in the segment list??  Yuck.
> >>
> >> Thanks,
> >>
> >> Adam

Reply via email to