onHttpRequest() as part of the public API

Silly me, always trying to expose internals as public API. :-)

This is ultimately what I need for embedding the tracker into web servers. I added an example for illustration.