about summary refs log tree commit homepage
path: root/examples
diff options
context:
space:
mode:
authorzedshaw <zedshaw@19e92222-5c0b-0410-8929-a290d50e31e9>2006-03-25 21:15:30 +0000
committerzedshaw <zedshaw@19e92222-5c0b-0410-8929-a290d50e31e9>2006-03-25 21:15:30 +0000
commitf4a5c938d461d9c5dc17f521c9efaaf352b931fa (patch)
treec8f5d6799e74a4b9dd6d533424ee093ef4d3beb4 /examples
parent8287106809a82ccd1afba674740486946509b856 (diff)
downloadunicorn-f4a5c938d461d9c5dc17f521c9efaaf352b931fa.tar.gz
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@121 19e92222-5c0b-0410-8929-a290d50e31e9
Diffstat (limited to 'examples')
-rw-r--r--examples/builder.rb13
-rw-r--r--examples/mime.yaml3
2 files changed, 15 insertions, 1 deletions
diff --git a/examples/builder.rb b/examples/builder.rb
index 0319377..5f0803a 100644
--- a/examples/builder.rb
+++ b/examples/builder.rb
@@ -1,11 +1,22 @@
 require 'mongrel'
 
+class TestPlugin < GemPlugin::Plugin "/handlers"
+  include Mongrel::HttpHandlerPlugin
+
+  def process(request, response)
+    STDERR.puts "My options are: #{options.inspect}"
+    STDERR.puts "Request Was:"
+    STDERR.puts request.params.to_yaml
+  end
+end
+
 config = Mongrel::Configurator.new :host => "127.0.0.1" do
   load_plugins :includes => ["mongrel"], :excludes => ["rails"]
   daemonize :cwd => Dir.pwd, :log_file => "mongrel.log", :pid_file => "mongrel.pid"
   
   listener :port => 3000 do
-    uri "/app", :handler => Mongrel::DirHandler.new(".", load_mime_map("mime.yaml"))
+    uri "/app", :handler => plugin("/handlers/testplugin", :test => "that")
+    uri "/app", :handler => Mongrel::DirHandler.new(".")
     load_plugins :includes => ["mongrel", "rails"]
   end
 
diff --git a/examples/mime.yaml b/examples/mime.yaml
new file mode 100644
index 0000000..6e7bb04
--- /dev/null
+++ b/examples/mime.yaml
@@ -0,0 +1,3 @@
+---
+.jpeg: image/jpeg
+.png: image/test