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

Jan Svitok jan.svitok at gmail.com
Fri Mar 16 09:53:50 EDT 2007


On 3/16/07, Jeroen Houben <jeroen at supercool.nl> wrote:
> Jan Svitok wrote:
> > On 3/15/07, Jeroen Houben <jeroen at supercool.nl> wrote:
> >
> >> Jeroen Houben wrote:
> >>
> >>> Hi Zed, thanks for your reply.
> >>>
> >>> Okay I understand the theory, but how do I continue? I thought simply
> >>> returning from my process() method would do the trick, but the code
> >>> below doesn't work, it gives a 404 for files that do exists, but are not
> >>> flv. I just want any file that is not .flv to be served normally.
> >>>
> >
> > Hi,
> >
> > if nobody answers, maybe you can resort to reading the mongrel sources ;-)
> >
> > I suspect that the problem is that the "normal processing"
> > plugin is not there. See the lines just after those I posted. Or add
> > some traces there to see what's going on(like what handlers are tried
> > etc.)
> >
>
> I think you're right, adding some traces gives me this:
>
> outputtings handlers for /10/metadata.yml
> Streamert
>
> outputtings handlers for /favicon.ico
> Mongrel::Rails::RailsHandler
>
> outputtings handlers for /favicon.ico
> Mongrel::Rails::RailsHandler
>
> I wonder why it hasn't registered the Streamert handler in front of the
> rails handler. Here's my config
>
> uri "/movies",
>   :handler => plugin("/handlers/streamert"),
>   :in_front => true
>
>
> if I change the first line to  uri "/",
>
> things will work, but I then my plugin gets called for every request.
> Not very efficient, I mean, it's fine for what I'm going to do, but
> having it "listen" only to URLs under /movies seems more elegant.
>
> Anyways, thanks for your help!
>
> Jeroen

I guess it's designed to enable override for particular subtrees, e.
g. / for rails *Except* /img that will be handled by a special
handler.

Maybe there's a way to tell Rails handler to listen on / and /movies
or create another rails handler, though I think the first approach
will be easier - you probably don't want to have two rails handlers in
one mongrel, but I might be wrong.


More information about the Mongrel-users mailing list