| Module | Mongrel::Camping |
| In: |
lib/mongrel/camping.rb
lib/mongrel/camping.rb |
Support for the Camping micro framework at camping.rubyforge.org This implements the unusually long Postamble that Camping usually needs and shrinks it down to just a single line or two.
Your Postamble would now be:
Mongrel::Camping::start("0.0.0.0",3001,"/tepee",Tepee).join
If you wish to get fancier than this then you can use the Camping::CampingHandler directly instead and do your own wiring:
h = Mongrel::HttpServer.new(server, port)
h.register(uri, CampingHandler.new(Tepee))
h.register("/favicon.ico", Mongrel::Error404Handler.new(""))
I add the /favicon.ico since camping apps typically don‘t have them and it‘s just annoying anyway.
This is a convenience method that wires up a CampingHandler for your application on a given port and uri. It‘s pretty much all you need for a camping application to work right.
It returns the Mongrel::HttpServer which you should either join or somehow manage. The thread is running when returned.
# File lib/mongrel/camping.rb, line 99
99: def Camping.start(server, port, uri, klass)
100: h = Mongrel::HttpServer.new(server, port)
101: h.register(uri, CampingHandler.new(klass))
102: h.register("/favicon.ico", Mongrel::Error404Handler.new(""))
103: h.run
104: return h
105: end
This is a convenience method that wires up a CampingHandler for your application on a given port and uri. It‘s pretty much all you need for a camping application to work right.
It returns the Mongrel::HttpServer which you should either join or somehow manage. The thread is running when returned.
# File lib/mongrel/camping.rb, line 99
99: def Camping.start(server, port, uri, klass)
100: h = Mongrel::HttpServer.new(server, port)
101: h.register(uri, CampingHandler.new(klass))
102: h.register("/favicon.ico", Mongrel::Error404Handler.new(""))
103: h.run
104: return h
105: end