Forum: Ruby WEBrick::Daemon and WEBrick

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Aaron S. (Guest)
on 2007-03-10 00:08
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.
Eric H. (Guest)
on 2007-03-18 03:14
(Received via mailing list)
On Mar 9, 2007, at 14:08, Aaron S. wrote:
> 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.
Aaron S. (Guest)
on 2007-03-18 05:47
Eric H. wrote:
> On Mar 9, 2007, at 14:08, Aaron S. wrote:
>> 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.

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
This topic is locked and can not be replied to.