Sha256: 0e0c647b6e9bc8423d3dd22d972622ab9e561aad13e72f1f50f36e4c4cdde698
Contents?: true
Size: 473 Bytes
Versions: 65
Compression:
Stored size: 473 Bytes
Contents
#!/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
Version data entries
65 entries across 65 versions & 9 rubygems