[Seaside] [Seaside REST] handling subpaths

Philippe Marschall philippe.marschall at gmail.com
Sat Mar 10 14:28:33 UTC 2012

2012/3/10 Sebastian Sastre <sebastian at flowingconcept.com>:
> 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.


More information about the seaside mailing list