WEBrick::Daemon and WEBrick

Discussion in 'Ruby' started by Aaron Smith, Mar 9, 2007.

  1. Aaron Smith

    Aaron Smith Guest

    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-forum.com/.
    Aaron Smith, Mar 9, 2007
    #1
    1. Advertising

  2. Aaron Smith

    Eric Hodel Guest

    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.
    Eric Hodel, Mar 18, 2007
    #2
    1. Advertising

  3. Aaron Smith

    Aaron Smith Guest

    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-forum.com/.
    Aaron Smith, Mar 18, 2007
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jean-Paul Calderone
    Replies:
    0
    Views:
    450
    Jean-Paul Calderone
    Mar 20, 2009
  2. Floris Bruynooghe
    Replies:
    1
    Views:
    448
    Floris Bruynooghe
    Mar 24, 2009
  3. Sam Kong
    Replies:
    2
    Views:
    186
    Matias Surdi
    Dec 23, 2005
  4. Ashley Moran

    How do I run WEBrick as a daemon?

    Ashley Moran, Dec 13, 2006, in forum: Ruby
    Replies:
    4
    Views:
    174
    Gregory Brown
    Dec 13, 2006
  5. Daemon Win32::Daemon;

    , Sep 7, 2006, in forum: Perl Misc
    Replies:
    0
    Views:
    249
Loading...

Share This Page