diff options
author | zedshaw <zedshaw@19e92222-5c0b-0410-8929-a290d50e31e9> | 2006-11-25 04:58:29 +0000 |
---|---|---|
committer | zedshaw <zedshaw@19e92222-5c0b-0410-8929-a290d50e31e9> | 2006-11-25 04:58:29 +0000 |
commit | d15b43d5c4cf3d87680d8e90d68ac28e14a5c0f0 (patch) | |
tree | 92aa8e4dcb082ec099e0fa1e4fcda9b50d3df6f9 /lib | |
parent | b96bf4aeeb6e46f0378af41d8e752218c228f3bf (diff) | |
download | unicorn-d15b43d5c4cf3d87680d8e90d68ac28e14a5c0f0.tar.gz |
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@417 19e92222-5c0b-0410-8929-a290d50e31e9
Diffstat (limited to 'lib')
-rw-r--r-- | lib/mongrel/camping.rb | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/lib/mongrel/camping.rb b/lib/mongrel/camping.rb index 171dbf6..ed4d12f 100644 --- a/lib/mongrel/camping.rb +++ b/lib/mongrel/camping.rb @@ -6,6 +6,7 @@ require 'mongrel' + module Mongrel # Support for the Camping micro framework at http://camping.rubyforge.org # This implements the unusually long Postamble that Camping usually @@ -84,13 +85,23 @@ module Mongrel response.send_header response.write(body) end - rescue Errno::EPIPE - # ignored - rescue Object => camping_error - STDERR.puts "Error calling #{@klass}.run #{camping_error.inspect}" - STDERR.puts camping_error.backtrace.join("\n") end 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. + + def Camping.start(server, port, uri, klass) + h = Mongrel::HttpServer.new(server, port) + h.register(uri, CampingHandler.new(klass)) + h.register("/favicon.ico", Mongrel::Error404Handler.new("")) + h.run + return h + end end end |