REST - How to do step 6?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

REST - How to do step 6?

Peter Kwangjun Suk
Howdy,

I've mashed-up the JSON code in the Magritte addons and Seaside-REST
and can publish data as JSON.  Unfortunatley, I'm doing this through a
FileHandler because I can't quite figure out Philippe Marschall's step
6:  <http://lists.squeakfoundation.org/pipermail/seaside-dev/2009-September/003584.html>

What you need to get started:
 1. latest Seaside 3.0
 2. Seaside-REST [1]
 3. make a subclass of WARestfulHandler
 4. implement #createRoutes
 5. implement the methods
 6. register the handler (see caveats)

I tried:
        WAAdmin register: WAMyClassREST at: 'getevents'.

But this doesn't do what I think it should.

What am I missing?

--Peter

--
There's neither heaven not hell,
save what we grant ourselves.
There's neither fairness nor justice,
save what we grant each other.
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: REST - How to do step 6?

Tobias Pape

Am 2011-04-09 um 19:48 schrieb Peter Kwangjun Suk:

> Howdy,
>
> I've mashed-up the JSON code in the Magritte addons and Seaside-REST
> and can publish data as JSON.  Unfortunatley, I'm doing this through a
> FileHandler because I can't quite figure out Philippe Marschall's step
> 6:  <http://lists.squeakfoundation.org/pipermail/seaside-dev/2009-September/003584.html>
>
> What you need to get started:
> 1. latest Seaside 3.0
> 2. Seaside-REST [1]
> 3. make a subclass of WARestfulHandler
> 4. implement #createRoutes
> 5. implement the methods
> 6. register the handler (see caveats)
>
> I tried:
>        WAAdmin register: WAMyClassREST at: 'getevents'.
>

Do it like

(WAAdmin
        register: WAMySomethingComponent
        at: 'component)
       
        addFilter: WAMyClassREST


So Long
        -Tobias_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: REST - How to do step 6?

Peter Kwangjun Suk
On Sat, Apr 9, 2011 at 2:40 PM, Tobias Pape <[hidden email]> wrote:
> Do it like
>
> (WAAdmin
>        register: WAMySomethingComponent
>        at: 'component)
>
>        addFilter: WAMyClassREST

Thanks!  So, I take it that WAMySomethingComponent is a subclass of
WAComponent and that WAMyClassREST is the subclass of
WARestfulHandler?

--Peter

--
There's neither heaven not hell,
save what we grant ourselves.
There's neither fairness nor justice,
save what we grant each other.
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: REST - How to do step 6?

Philippe Marschall
In reply to this post by Peter Kwangjun Suk
2011/4/9 Peter Kwangjun Suk <[hidden email]>:

> Howdy,
>
> I've mashed-up the JSON code in the Magritte addons and Seaside-REST
> and can publish data as JSON.  Unfortunatley, I'm doing this through a
> FileHandler because I can't quite figure out Philippe Marschall's step
> 6:  <http://lists.squeakfoundation.org/pipermail/seaside-dev/2009-September/003584.html>
>
> What you need to get started:
>  1. latest Seaside 3.0
>  2. Seaside-REST [1]
>  3. make a subclass of WARestfulHandler
>  4. implement #createRoutes
>  5. implement the methods
>  6. register the handler (see caveats)
>
> I tried:
>        WAAdmin register: WAMyClassREST at: 'getevents'.
>
> But this doesn't do what I think it should.
>
> What am I missing?

When you subclass WARestfulHandler and implement #createRoutes you
can't use pragmas. To find out what goes wrong set a break point in
WARestfulHandler >> #handleFiltered:.

Cheers
Philippe
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: REST - How to do step 6?

Peter Kwangjun Suk
On Sun, Apr 10, 2011 at 2:36 AM, Philippe Marschall
<[hidden email]> wrote:
> When you subclass WARestfulHandler and implement #createRoutes you
> can't use pragmas. To find out what goes wrong set a break point in
> WARestfulHandler >> #handleFiltered:.

On Sat, Apr 9, 2011 at 2:40 PM, Tobias Pape <[hidden email]> wrote:
> Do it like
>
> (WAAdmin
>        register: WAMySomethingComponent
>        at: 'component)
>        addFilter: WAMyClassREST

Is there documentation on using the pragmas?  Actually, I'll defer on
that for now.  I should interpret the above as:

        (WAAdmin
                register: WAComponentMySubclass
                at: 'component)
                addFilter: WARestfulHandlerMySubclass

My method that returns the JSON text should be on the
WAComponentMySubclass, but the WARestfulHandlerMySubclass is the part
that redirects the rendering of the URL path to the component?

--Peter

--
There's neither heaven not hell,
save what we grant ourselves.
There's neither fairness nor justice,
save what we grant each other.
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: REST - How to do step 6?

Philippe Marschall
2011/4/10 Peter Kwangjun Suk <[hidden email]>:

> On Sun, Apr 10, 2011 at 2:36 AM, Philippe Marschall
> <[hidden email]> wrote:
>> When you subclass WARestfulHandler and implement #createRoutes you
>> can't use pragmas. To find out what goes wrong set a break point in
>> WARestfulHandler >> #handleFiltered:.
>
> On Sat, Apr 9, 2011 at 2:40 PM, Tobias Pape <[hidden email]> wrote:
>> Do it like
>>
>> (WAAdmin
>>        register: WAMySomethingComponent
>>        at: 'component)
>>        addFilter: WAMyClassREST
>
> Is there documentation on using the pragmas?

http://code.google.com/p/seaside/wiki/SeasideRest

> Actually, I'll defer on
> that for now.  I should interpret the above as:
>
>        (WAAdmin
>                register: WAComponentMySubclass
>                at: 'component)
>                addFilter: WARestfulHandlerMySubclass
>
> My method that returns the JSON text should be on the
> WAComponentMySubclass, but the WARestfulHandlerMySubclass is the part
> that redirects the rendering of the URL path to the component?

First WARestfulHandlerMySubclass gets a chance to handle the request.
If nothing matches it delegates to WAComponentMySubclass. Where to put
the method depends on whether you need to access the session and
continuations or you want a constant URL.

Cheers
Philippe
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside