[Seaside REST] handling subpaths

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

[Seaside REST] handling subpaths

sebastianconcept@gmail.co
Hi guys,

if you have this:

RestfulHandler
|-UserHandler
|-PersonHandler
|-CompanyHandler
|-AlbumHandler
L_RecordHandler

and you want to access this:

api/
api/User
api/Person
apiCompany
api/Album
api/Record

how do you do that?


PS: What I've tried so far is to set a class-side #initialize on all of them to register an handler at everyone of those paths. 

Example:

UserHandler class>>initialize

WAAdmin register: self at: self basePath,'/User'

#basePath returns 'api'.

The problem is that RestfulHandler also registers because there are some actions to be done in the path api/{action} and it causes some trouble. Registering this guy adds the handler at the root path and it seems that, in order to be able to register/handle the subpaths, seaside needs in the root path a dispatcher instead, so..?

PSS: It would be wonderful to just register 'api' and let the handler take care of every action with every pragma, the problem for that is that it won't scale well in complexity. The solution to that is to subclass that handler root class and perform the actions where matters, but I didn't figured out how that can be done in Seaside REST or if it's possible (if you have ideas on improving this I'd like to hear).

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

Re: [Seaside REST] handling subpaths

Philippe Marschall
2012/3/10 Sebastian Sastre <[hidden email]>:

> Hi guys,
>
> if you have this:
>
> RestfulHandler
> |-UserHandler
> |-PersonHandler
> |-CompanyHandler
> |-AlbumHandler
> L_RecordHandler
>
> and you want to access this:
>
> api/
> api/User
> api/Person
> apiCompany
> api/Album
> api/Record
>
> how do you do that?
>
> sebastian
>
> o/
>
>
>
> PS: What I've tried so far is to set a class-side #initialize on all of them
> to register an handler at everyone of those paths.
>
> Example:
>
> UserHandler class>>initialize
>
> WAAdmin register: self at: self basePath,'/User'
>
> #basePath returns 'api'.
>
> The problem is that RestfulHandler also registers because there are some
> actions to be done in the path api/{action} and it causes some trouble.
> Registering this guy adds the handler at the root path and it seems that, in
> order to be able to register/handle the subpaths, seaside needs in the root
> path a dispatcher instead, so..?
>
> PSS: It would be wonderful to just register 'api' and let the handler take
> care of every action with every pragma, the problem for that is that it
> won't scale well in complexity. The solution to that is to subclass that
> handler root class and perform the actions where matters, but I didn't
> figured out how that can be done in Seaside REST or if it's possible (if you
> have ideas on improving this I'd like to hear).

A solution would be to turn UserHandler and friends into filters. Then
you can add them to an API handler that just returns 404.

You need the latest 3.1 code for this to work.

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: [Seaside REST] handling subpaths

sebastianconcept@gmail.co
sounds good.

I 'll try.

I don't see a metacello configuration...

how do I load Seaside 3.1?



On Mar 10, 2012, at 11:28 AM, Philippe Marschall wrote:

> 2012/3/10 Sebastian Sastre <[hidden email]>:
>> Hi guys,
>>
>> if you have this:
>>
>> RestfulHandler
>> |-UserHandler
>> |-PersonHandler
>> |-CompanyHandler
>> |-AlbumHandler
>> L_RecordHandler
>>
>> and you want to access this:
>>
>> api/
>> api/User
>> api/Person
>> apiCompany
>> api/Album
>> api/Record
>>
>> how do you do that?
>>
>> sebastian
>>
>> o/
>>
>>
>>
>> PS: What I've tried so far is to set a class-side #initialize on all of them
>> to register an handler at everyone of those paths.
>>
>> Example:
>>
>> UserHandler class>>initialize
>>
>> WAAdmin register: self at: self basePath,'/User'
>>
>> #basePath returns 'api'.
>>
>> The problem is that RestfulHandler also registers because there are some
>> actions to be done in the path api/{action} and it causes some trouble.
>> Registering this guy adds the handler at the root path and it seems that, in
>> order to be able to register/handle the subpaths, seaside needs in the root
>> path a dispatcher instead, so..?
>>
>> PSS: It would be wonderful to just register 'api' and let the handler take
>> care of every action with every pragma, the problem for that is that it
>> won't scale well in complexity. The solution to that is to subclass that
>> handler root class and perform the actions where matters, but I didn't
>> figured out how that can be done in Seaside REST or if it's possible (if you
>> have ideas on improving this I'd like to hear).
>
> A solution would be to turn UserHandler and friends into filters. Then
> you can add them to an API handler that just returns 404.
>
> You need the latest 3.1 code for this to work.
>
> Cheers
> Philippe
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



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