WEBrick::Daemon and WEBrick

A

Aaron Smith

Is it possible to use the WEBrick::Daemon with WEBrick::AbstractServlet.
Here is what i'm running for the basic servlet:

dir = Dir::pwd
server = WEBrick::HTTPServer.new(
:port => port,
:DocumentRoot => dir
end

server.mount "/gateway", RUBYAMF::WEBrickServlet
trap "INT" do server.shutdown end
server.start

I've seen an example saying you have to subclass the HTTPServer and just
run the WEBrick::Daemon.start when initializing. But can this be done
with servlets?

Thanks.
 
E

Eric Hodel

Is it possible to use the WEBrick::Daemon with
WEBrick::AbstractServlet.
Here is what i'm running for the basic servlet:

dir = Dir::pwd
server = WEBrick::HTTPServer.new(
:port => port,
:DocumentRoot => dir
end

server.mount "/gateway", RUBYAMF::WEBrickServlet
trap "INT" do server.shutdown end
server.start

I've seen an example saying you have to subclass the HTTPServer and
just
run the WEBrick::Daemon.start when initializing. But can this be done
with servlets?

Servlets run in a server, so daemonize after you've started the
HTTPServer and mounted your servlets.
 
A

Aaron Smith

Eric said:
Servlets run in a server, so daemonize after you've started the
HTTPServer and mounted your servlets.

I figured it out actually:

server = WEBrick::HTTPServer.new(
:port => OPTIONS[:port],
:DocumentRoot => OPTIONS[:working_dir],
:ServerType => OPTIONS[:server_type],
:BindAddress => OPTIONS[:ip]
)


server type is either WEBrick::Daemon of WEBrick::SimpleServer
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,968
Messages
2,570,152
Members
46,697
Latest member
AugustNabo

Latest Threads

Top