lib/mizuno/server.rb
def run(app, options = {})
            # Symbolize and downcase keys.
            @options = options = Hash[options.map { |k, v| 
                [ k.to_s.downcase.to_sym, v ] }]
            options[:quiet] ||= true if options[:embedded]

            # The Jetty server
            Logger.configure(options)
            @logger = Logger.logger
            @server = Java.org.eclipse.jetty.server.Server.new
            @server.setSendServerVersion(false)

            # Thread pool
            threads = options[:threads] || 50
            thread_pool = QueuedThreadPool.new
            thread_pool.min_threads = options.fetch(:min_threads,
                [ threads.to_i / 10, 5 ].max)
            thread_pool.max_threads = [ threads.to_i, 10 ].max
            @server.set_thread_pool(thread_pool)

            # Connector
            connector = SelectChannelConnector.new
            connector.setReuseAddress(options.fetch(:reuse_address, false))
            connector.setPort(options[:port].to_i)
            connector.setHost(options[:host])
            max_header_size = options.fetch(:max_header_size, 32768)
            connector.setRequestHeaderSize(max_header_size)
            
            @server.addConnector(connector)

            # SSL Connector
            configure_https(options) if options[:ssl_port]

            # Switch to a different user or group if we were asked to.
            Runner.setgid(options) if options[:group]
            Runner.setuid(options) if options[:user]

            # Optionally wrap with Mizuno::Reloader.
            threshold = (ENV['RACK_ENV'] == 'production' ? 10 : 1)
            app = Mizuno::Reloader.new(app, threshold) \
                if options[:reloadable]

            # The servlet itself.
            rack_handler = RackHandler.new(self)
            rack_handler.rackup(app)

            # Add the context to the server and start.
            @server.set_handler(rack_handler)
            @server.start
            $stderr.printf("%s listening on %s:%s\n", version,
                connector.host, connector.port) unless options[:quiet]

            # If we're embedded, we're done.
            return if options[:embedded]

            # Stop the server when we get The Signal.
            trap("SIGTERM") { @server.stop and exit }

            # Join with the server thread, so that currently open file
            # descriptors don't get closed by accident.
            # http://www.ruby-forum.com/topic/209252
            @server.join
        end
def run(app, options = {})
            # Symbolize and downcase keys.
            @options = options = Hash[options.map { |k, v| 
                [ k.to_s.downcase.to_sym, v ] }]
            options[:quiet] ||= true if options[:embedded]

            # The Jetty server
            Logger.configure(options)
            @logger = Logger.logger
            @server = Java.org.eclipse.jetty.server.Server.new
            @server.setSendServerVersion(false)

            # Thread pool
            threads = options[:threads] || 50
            thread_pool = QueuedThreadPool.new
            thread_pool.min_threads = options.fetch(:min_threads,
                [ threads.to_i / 10, 5 ].max)
            thread_pool.max_threads = [ threads.to_i, 10 ].max
            @server.set_thread_pool(thread_pool)

            # Connector
            connector = SelectChannelConnector.new
            connector.setReuseAddress(options.fetch(:reuse_address, false))
            connector.setPort(options[:port].to_i)
            connector.setHost(options[:host])
            max_header_size = options.fetch(:max_header_size, 32768)
            connector.setRequestHeaderSize(max_header_size)
            
            @server.addConnector(connector)

            # SSL Connector
            configure_https(options) if options[:ssl_port]

            # Switch to a different user or group if we were asked to.
            Runner.setgid(options) if options[:group]
            Runner.setuid(options) if options[:user]

            # Optionally wrap with Mizuno::Reloader.
            threshold = (ENV['RACK_ENV'] == 'production' ? 10 : 1)
            app = Mizuno::Reloader.new(app, threshold) \
                if options[:reloadable]

            # The servlet itself.
            rack_handler = RackHandler.new(self)
            rack_handler.rackup(app)

            # Add the context to the server and start.
            @server.set_handler(rack_handler)
            @server.start
            $stderr.printf("%s listening on %s:%s\n", version,
                connector.host, connector.port) unless options[:quiet]

            # If we're embedded, we're done.
            return if options[:embedded]

            # Stop the server when we get The Signal.
            trap("SIGTERM") { @server.stop and exit }

            # Join with the server thread, so that currently open file
            # descriptors don't get closed by accident.
            # http://www.ruby-forum.com/topic/209252
            @server.join
        end
def run ( app , options = { } ) # Symbolize and downcase keys. @options = options = Hash [ options . map { | k , v | [ k . to_s . downcase . to_sym , v ] } ] options [ :quiet ] ||= true if options [ :embedded ] # The Jetty server Logger . configure ( options ) @logger = Logger . logger @server = Java . org . eclipse . jetty . server . Server . new @server . setSendServerVersion ( false ) # Thread pool threads = options [ :threads ] || 50 thread_pool = QueuedThreadPool . new thread_pool . min_threads = options . fetch ( :min_threads , [ threads . to_i / 10 , 5 ] . max ) thread_pool . max_threads = [ threads . to_i , 10 ] . max @server . set_thread_pool ( thread_pool ) # Connector connector = SelectChannelConnector . new connector . setReuseAddress ( options . fetch ( :reuse_address , false ) ) connector . setPort ( options [ :port ] . to_i ) connector . setHost ( options [ :host ] ) max_header_size = options . fetch ( :max_header_size , 32768 ) connector . setRequestHeaderSize ( max_header_size ) @server . addConnector ( connector ) # SSL Connector configure_https ( options ) if options [ :ssl_port ] # Switch to a different user or group if we were asked to. Runner . setgid ( options ) if options [ :group ] Runner . setuid ( options ) if options [ :user ] # Optionally wrap with Mizuno::Reloader. threshold = ( ENV [ 'RACK_ENV' ] == 'production' ? 10 : 1 ) app = Mizuno :: Reloader . new ( app , threshold ) if options [ :reloadable ] # The servlet itself. rack_handler = RackHandler . new ( self ) rack_handler . rackup ( app ) # Add the context to the server and start. @server . set_handler ( rack_handler ) @server . start $stderr . printf ( "%s listening on %s:%s\n" , version , connector . host , connector . port ) unless options [ :quiet ] # If we're embedded, we're done. return if options [ :embedded ] # Stop the server when we get The Signal. trap ( "SIGTERM" ) { @server . stop and exit } # Join with the server thread, so that currently open file # descriptors don't get closed by accident. # http://www.ruby-forum.com/topic/209252 @server . join end
Start up an instance of Jetty, running a Rack application.
 Options can be any of the follwing, and are not
 case-sensitive:

 :host::
     String specifying the IP address to bind to; defaults
     to 0.0.0.0.

 :port::
     String or integer with the port to bind to; defaults
     to 9292.
Start up an instance of Jetty running a Rack application . Options can be any of the follwing and are not case - sensitive :