Hi, I''m trying to write a file upload monitor for mongrel that uses juggernaut to alert the browser of a change. I''m writing a plugin that uses Mongrel::HttpHandlerPlugin but it looks like the only method that gets called is process and that is only when the upload has finished. I''m setting the following: @request_notify = true But I am still only getting process to come through. Any ideas? -- Carl Woodward
Hi everyone, I believe I have found the problem. In mongrel.rb (current stable release) line 568: --------------- notifier = handlers[0].request_notify ? handlers[0] : nil request = HttpRequest.new(params, client, notifier) --------------->From what i can see, plugins that set request_notify will never be notified.Should HttpRequest.initialize take an array of notifiers? That way you can just change the notifier code to be: request = HttpRequest.new(params, client, notifiers.select { |notifier| notifier.request_notify }) I have changed the code very simply to get my plugin to work: notifiers = handlers.select { |handler| handler.request_notify } notifier = notifiers.empty? ? nil : notifiers[0] request = HttpRequest.new(params, client, notifier) This is a very simple change that will get me through for the moment but I am interested to get feedback from the masters on whether I am just being stupid. Any help would be greatly appreciated? Thanks, Carl. On 10/20/06, Carl Woodward <cjwoodward at gmail.com> wrote:> Hi, > > I''m trying to write a file upload monitor for mongrel that uses > juggernaut to alert the browser of a change. I''m writing a plugin that > uses Mongrel::HttpHandlerPlugin but it looks like the only method that > gets called is process and that is only when the upload has finished. > I''m setting the following: > > @request_notify = true > > But I am still only getting process to come through. > > Any ideas? > > -- > Carl Woodward >-- Carl Woodward 0412218979 cjwoodward at gmail.com
Hi Zed, I''m using that code as a base but I couldn''t get it to work. I think that the email that I sent before explains why it wouldn''t work for me unless I''m doing something stupid in the config then it should work now. I.E. have a read of the last email. Cheers, Carl. On 10/20/06, Zed A. Shaw <zedshaw at zedshaw.com> wrote:> On Fri, 20 Oct 2006 08:24:13 +1000 > "Carl Woodward" <cjwoodward at gmail.com> wrote: > > > Hi, > > > > I''m trying to write a file upload monitor for mongrel that uses > > juggernaut to alert the browser of a change. I''m writing a plugin that > > uses Mongrel::HttpHandlerPlugin but it looks like the only method that > > gets called is process and that is only when the upload has finished. > > I''m setting the following: > > > > @request_notify = true > > > > But I am still only getting process to come through. > > > > Any ideas? > > Did you check out the existing mongrel_upload_progress code works? I''d base your work on that before striking out on your own. > > > -- > Zed A. Shaw, MUDCRAP-CE Master Black Belt Sifu > http://www.zedshaw.com/ > http://mongrel.rubyforge.org/ > http://www.lingr.com/room/3yXhqKbfPy8 -- Come get help. > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users >-- Carl Woodward 0412218979 cjwoodward at gmail.com
On 10/19/06, Zed A. Shaw <zedshaw at zedshaw.com> wrote:> On Fri, 20 Oct 2006 08:24:13 +1000 > "Carl Woodward" <cjwoodward at gmail.com> wrote: > > > Hi, > > > > I''m trying to write a file upload monitor for mongrel that uses > > juggernaut to alert the browser of a change. I''m writing a plugin that > > uses Mongrel::HttpHandlerPlugin but it looks like the only method that > > gets called is process and that is only when the upload has finished. > > I''m setting the following: > > > > @request_notify = true > > > > But I am still only getting process to come through. > > > > Any ideas? > > Did you check out the existing mongrel_upload_progress code works? I''d base your work on that before striking out on your own.It should work just fine. You just need to write a custom action to return the status for juggernaut though. I''m not sure how you prefer to do that. The MUP example in the docs show a rails action to return custom javascript code for an iframe... -- Rick Olson http://weblog.techno-weenie.net http://mephistoblog.com
Hi Rick, I actually think I found a bug in mongrel, see a couple of emails back. I would be really interested in your feedback? Thanks, Carl. On 10/20/06, Rick Olson <technoweenie at gmail.com> wrote:> On 10/19/06, Zed A. Shaw <zedshaw at zedshaw.com> wrote: > > On Fri, 20 Oct 2006 08:24:13 +1000 > > "Carl Woodward" <cjwoodward at gmail.com> wrote: > > > > > Hi, > > > > > > I''m trying to write a file upload monitor for mongrel that uses > > > juggernaut to alert the browser of a change. I''m writing a plugin that > > > uses Mongrel::HttpHandlerPlugin but it looks like the only method that > > > gets called is process and that is only when the upload has finished. > > > I''m setting the following: > > > > > > @request_notify = true > > > > > > But I am still only getting process to come through. > > > > > > Any ideas? > > > > Did you check out the existing mongrel_upload_progress code works? I''d base your work on that before striking out on your own. > > It should work just fine. You just need to write a custom action to > return the status for juggernaut though. I''m not sure how you prefer > to do that. The MUP example in the docs show a rails action to return > custom javascript code for an iframe... > > -- > Rick Olson > http://weblog.techno-weenie.net > http://mephistoblog.com > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users >-- Carl Woodward 0412218979 cjwoodward at gmail.com
On 10/19/06, Carl Woodward <cjwoodward at gmail.com> wrote:> Hi Rick, I actually think I found a bug in mongrel, see a couple of > emails back. I would be really interested in your feedback? >I think the idea is you use :in_front => true to put your filter w/ a notifier in the front. Or, you can use #detect instead of select, which returns the first match. -- Rick Olson http://weblog.techno-weenie.net http://mephistoblog.com
On Fri, 20 Oct 2006 08:24:13 +1000 "Carl Woodward" <cjwoodward at gmail.com> wrote:> Hi, > > I''m trying to write a file upload monitor for mongrel that uses > juggernaut to alert the browser of a change. I''m writing a plugin that > uses Mongrel::HttpHandlerPlugin but it looks like the only method that > gets called is process and that is only when the upload has finished. > I''m setting the following: > > @request_notify = true > > But I am still only getting process to come through. > > Any ideas?Did you check out the existing mongrel_upload_progress code works? I''d base your work on that before striking out on your own. -- Zed A. Shaw, MUDCRAP-CE Master Black Belt Sifu http://www.zedshaw.com/ http://mongrel.rubyforge.org/ http://www.lingr.com/room/3yXhqKbfPy8 -- Come get help.
> I think the idea is you use :in_front => true to put your filter w/ a > notifier in the front. Or, you can use #detect instead of select, > which returns the first match.So you can only have one handler with a notifier? Is this intended? What will happen if there are two :in_fronts? Last one wins? Not to be nitpicky, but this smells like a bug or at least should be documented?
Silly me... it does appear to be documented: http://mongrel.rubyforge.org/rdoc/classes/Mongrel/HttpHandler.html#M000070 On 10/21/06, Eden Li <eden.li at gmail.com> wrote:> > I think the idea is you use :in_front => true to put your filter w/ a > > notifier in the front. Or, you can use #detect instead of select, > > which returns the first match. > > So you can only have one handler with a notifier? Is this intended? > What will happen if there are two :in_fronts? Last one wins? > > Not to be nitpicky, but this smells like a bug or at least should be documented?