Class: Rack::Handler::Jetty
- Inherits:
-
Object
- Object
- Rack::Handler::Jetty
- Defined in:
- lib/rack/handler/jetty.rb
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(app, options = {}) ⇒ Jetty
constructor
A new instance of Jetty.
- #run ⇒ Object
- #running? ⇒ Boolean
- #stop ⇒ Object
- #stopped? ⇒ Boolean
Constructor Details
#initialize(app, options = {}) ⇒ Jetty
Returns a new instance of Jetty.
10 11 12 13 |
# File 'lib/rack/handler/jetty.rb', line 10 def initialize(app, ={}) @app = app @options = end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
7 8 9 |
# File 'lib/rack/handler/jetty.rb', line 7 def app @app end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
8 9 10 |
# File 'lib/rack/handler/jetty.rb', line 8 def @options end |
Class Method Details
.run(app, options = {}) ⇒ Object
15 16 17 |
# File 'lib/rack/handler/jetty.rb', line 15 def self.run(app, = {}) new(app,).run() end |
Instance Method Details
#run ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/rack/handler/jetty.rb', line 19 def run() @connector = Java::org.mortbay.jetty.bio.SocketConnector.new @connector.set_host([:Host]) @connector.set_port([:Port].to_i) @jetty = Java::org.mortbay.jetty.Server.new @jetty.addConnector(@connector) bridge = RackJetty::ServletHandler.new bridge.handler = self @jetty.set_handler(bridge) @jetty.start end |
#running? ⇒ Boolean
34 35 36 |
# File 'lib/rack/handler/jetty.rb', line 34 def running? @jetty && @jetty.is_started end |
#stop ⇒ Object
42 43 44 |
# File 'lib/rack/handler/jetty.rb', line 42 def stop() @jetty && @jetty.stop end |
#stopped? ⇒ Boolean
38 39 40 |
# File 'lib/rack/handler/jetty.rb', line 38 def stopped? !@jetty || @jetty.is_stopped end |