Re: Seaside-Rest question [WAS] Re: How can I make this kind of redirect in Seaside?

Mariano Martinez Peck <[email protected]>
Newsgroups gmane.comp.lang.smalltalk.squeak.seaside
Message-ID <CAA+-=mUDrNdaUttsnYCOKRgb5r8azXb_w6Ndv08zMy54m_SWLw@mail.gmail.com>
On Wed, Jul 19, 2017 at 9:43 AM, Esteban A. Maringolo <[email protected]>
wrote:

> 2017-07-18 19:57 GMT-03:00 Mariano Martinez Peck <[email protected]>:
>
> > BTW... how can I allow something like this:
> >
> > <path: '/companyreport/{ticker}/{reportName}'>
> >
> > I then somehow I would like to parse the URL inside the method so that I
> > answer the correct response based on the URL ...
>
>
> You should have a method like:
>
> getTicker: ticker report: reportName
>   <get>
>   <path: '/companyreport/{ticker}/{reportName}'>
>
> There you'll have the ticker and reportName placeHolders mapped to the
> argument variable names. It is, the arguments of the method will hold
> whatever you put in those placeholders.
>
> But keep in mind this will only match a URI as a whole, if for some
> reason you add query parameters to the request, like
> '/companyreport/AAPL/dailyChange?format=csv', you'll need another
> method, with another name and path pragma.
>
> That's why I implemented the "variableQuery" pragma [1], so you can
> have a fixed URI but variable queries mapped to a single smalltalk
> method. But it was removed [2] because there was a proper way [3] of
> implementing it I ignored/didn't understand at that time.
>
> This part of the framework is powerful, but certainly lacking
> examples, and without the behavior of [1] or [3] is too rigid for a
> flexible API.
>
> I could explain how it works, and use it as I do, but I can't tell I
> completely understand it as probably its creator does.
>
>

Cool. Thank you very much Esteban. Very helpful and detailed response.
Really appreciated,



> Regards,
>
> Esteban A. Maringolo
>
> [1] http://forum.world.st/New-Seaside-REST-Core-extension-td4872995.html
> [2] http://forum.world.st/REST-quot-variable-queries-quot-
> td4941376.html#a4941377
> [3] http://lists.squeakfoundation.org/pipermail/seaside/2014-
> December/031314.html
> _______________________________________________
> seaside mailing list
> [email protected]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>



-- 
Mariano
http://marianopeck.wordpress.com

_______________________________________________
seaside mailing list
[email protected]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.