[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

WEBrick::Daemon and WEBrick

warhero

3/9/2007 10:08:00 PM

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.

--
Posted via http://www.ruby-....

2 Answers

Eric Hodel

3/18/2007 1:14:00 AM

0

On Mar 9, 2007, at 14:08, Aaron Smith wrote:
> 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.

warhero

3/18/2007 3:47:00 AM

0

Eric Hodel wrote:
> On Mar 9, 2007, at 14:08, Aaron Smith 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

--
Posted via http://www.ruby-....