[Seaside] Seaside REST optional query parameters
Philippe Marschall
philippe.marschall at gmail.com
Sun Mar 24 14:55:12 UTC 2013
On Sun, Mar 24, 2013 at 1:08 PM, Chris <cpmbailey at btinternet.com> wrote:
> Does SeasideREST support optional query parameters so that you only have to
> write the one handler?
>
> i.e.
> getFoo: bar baz: baz
> <get>
> <path: '/foo?bar={bar}&baz={baz}'>
>
> and the baz variable is nil if the user just navigates to /foo?bar=1.
>
> Currently it won't match the path handler. There is a mention on the quick
> start about how some of the more complicated matching techniques can be
> applied to the query arguments but I can't see how to do it. Is it possible
> to use regex?
No, there isn't right now. But you can fake it by removing the
optional arguments from the pragma and manually looking them up.
getFoo: bar baz: baz
<get>
<path: '/foo?bar={bar}'>
| baz |
baz := self requestContext request at: 'baz' ifAbsent: [ nil ]
Cheers
Philippe
More information about the seaside
mailing list