[Mongrel] need help writing a plugin - Still hoping for an answer :-)

Zed A. Shaw zedshaw at zedshaw.com
Fri Mar 16 10:58:44 EDT 2007

On Fri, 16 Mar 2007 13:40:29 +0100
Jeroen Houben <jeroen at supercool.nl> wrote:

> uri "/movies",
>   :handler => plugin("/handlers/streamert"),
>   :in_front => true

You're on the right track, the only thing is you need to register it to
"/" not "/movies".  Then, your handler will be registered to the same
path as Rails but in front of the RailsHandler.

If you need to make sure requests are only for /movies, add a small bit
of checking for that in your handler.

Otherwise that should work.  Just FYI, how this works is handlers are
put onto a uri in a chain (just an array of handlers).  Before your
config it looks like this:

"/" => [RailsHandler]

What you did was this:

"/" => [RailsHandler], "/movies" => [streamert]

So, it'll only run when /movies is requested, but NOT chain onto
RailsHandler next.  By doing uri "/" instead of uri "/movies" you get

"/" => [streamert, RailsHandler]

Which is what you want.

Zed A. Shaw, MUDCRAP-CE Master Black Belt Sifu
http://www.awprofessional.com/title/0321483502 -- The Mongrel Book

More information about the Mongrel-users mailing list