Powered by Jekyll

Using Orbit as a WSAPI Filter

A nice trick that you can do with Orbit’s dispatcher is to write WSAPI filters, using the dispatch_wsapi method. This method takes one function and one or more patterns, just like the other Orbit dispatch methods. If the PATH_INFO matches any of the patterns Orbit’s dispatcher passes the unmodified WSAPI environment to the function, and just returns its results.

You can use this feature to easily add URL rewriting to any WSAPI application that does not depend on any feature of your web server, like “nice urls” for Sputnik. Th is a sputnik.ws script that uses Orbit to rewrite URLs such as http://server/sputnik.ws/wiki/node/name to http://server/sputnik.ws/?p=node/name, the format Sputnik expects:

blog comments powered by Disqus