1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00
puma--puma/examples/webrick_compare.rb
zedshaw 004dec2c2f initial import into trunk
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@4 19e92222-5c0b-0410-8929-a290d50e31e9
2006-01-28 19:03:53 +00:00

20 lines
No EOL
473 B
Ruby

#!/usr/local/bin/ruby
require 'webrick'
include WEBrick
s = HTTPServer.new( :Port => 4000 )
# HTTPServer#mount(path, servletclass)
# When a request referring "/hello" is received,
# the HTTPServer get an instance of servletclass
# and then call a method named do_"a HTTP method".
class HelloServlet < HTTPServlet::AbstractServlet
def do_GET(req, res)
res.body = "hello!"
res['Content-Type'] = "text/html"
end
end
s.mount("/test", HelloServlet)
s.start