Hmmm that is actually a good question, and to be honest I haven't really
thought about this before :)

I guess theoretically you could lift the routing strings from ApiServlet and
put the route => handler pairs in the configuration file, and thus adding a
new custom route would be as simple as configuring a route + class to handle
it (the autoloader should pick up on the class name no problem).

that would take care of the routing / handler part, but then you'd also have
to think of a clever way to re-work the in-&output converters, right now
it's a class per format (xml, atom, json) with a function per conversion
type (activity, person, app data).. you could however rework this to a class
per type (route name), with a convert xml / atom / json functions, and thus
being able to extend this dynamically too by depending on the autoloader
again.

Not a huge amount of code to realize I guess, if you feel motivated to code
this up and submit a patch I'd be more then happy to accept it! (or
otherwise put this suggestion on my overly long todo list, in which case i
would suggest filing a ticket in our jira system:
https://issues.apache.org/jira/secure/CreateIssue!default.jspa)

Hope that's of some help!

   -- Chris

On Wed, Nov 5, 2008 at 9:18 PM, Erik Gomersbach (Bluewin)
<[EMAIL PROTECTED]>wrote:

> Hi,
>
> I'm currently looking at extending the container functionality beyond the
> standard activity, app-data, messages and person services.
>
> For the client/javascript part I found the hi5 code very helpful with
> getting a better understanding on how to do this.
>
> Example:
>
> Hi5Container.prototype.newAlbumsRequest = function(idSpec, opt_params) {
>  var rpc = { method : "albums.get" };
> ...
>
> On the server/PHP side I've added code to the 'ApiServlet' class to handle
> the requests coming in on the new RPC topic, similar to how the other
> handlers are added.
>
> Now my question is if this is the best way to extend Shindig/PHP? Or is it
> possible to do this without having to change the 'ApiServlet' class?
>
> Thanks,
> Erik

Reply via email to