N
Naren
I want to set up a a machine as a servlet container using WEBrick. But
I want to be able to add several servlets, hopefully from separate Ruby
scripts. So here is the sample to start one servlet right,
====================
require "webrick"
server = WEBrick::HTTPServer.newPort => 8080, ocumentRoot =>
"C:\\WWW")
trap("INT") {server.shutdown}
class Servlet_A < WEBrick::HTTPServlet::AbstractServlet
HEAD = "<head><title>My Page</title></head>"
def do_GET(req, res)
var1 = req.query['var1']
var2 = req.query['var2']
result = DoStuff.new( var1, var2 )
res.body = "<html>#{HEAD}<body><h2>My
Page</h2>#{result}</body><html>"
end
end
server.mount("/pl", PLServlet)
server.start
=====================
Now I want to have another script that will have the implementation for
Servlet_B. But I want to mount that on the same server.
Any ideas on how to do that? Can it be done?
TIA
Naren
I want to be able to add several servlets, hopefully from separate Ruby
scripts. So here is the sample to start one servlet right,
====================
require "webrick"
server = WEBrick::HTTPServer.newPort => 8080, ocumentRoot =>
"C:\\WWW")
trap("INT") {server.shutdown}
class Servlet_A < WEBrick::HTTPServlet::AbstractServlet
HEAD = "<head><title>My Page</title></head>"
def do_GET(req, res)
var1 = req.query['var1']
var2 = req.query['var2']
result = DoStuff.new( var1, var2 )
res.body = "<html>#{HEAD}<body><h2>My
Page</h2>#{result}</body><html>"
end
end
server.mount("/pl", PLServlet)
server.start
=====================
Now I want to have another script that will have the implementation for
Servlet_B. But I want to mount that on the same server.
Any ideas on how to do that? Can it be done?
TIA
Naren