Class: Foxbat::WebHandler
- Inherits:
-
SimpleChannelUpstreamHandler
- Object
- SimpleChannelUpstreamHandler
- Foxbat::WebHandler
- Defined in:
- lib/foxbat/http_server.rb
Instance Method Summary collapse
-
#initialize(app) ⇒ WebHandler
constructor
A new instance of WebHandler.
- #messageReceived(ctx, e) ⇒ Object
Constructor Details
#initialize(app) ⇒ WebHandler
Returns a new instance of WebHandler.
41 42 43 44 |
# File 'lib/foxbat/http_server.rb', line 41 def initialize(app) super() @app = app end |
Instance Method Details
#messageReceived(ctx, e) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/foxbat/http_server.rb', line 46 def (ctx, e) req = e.getMessage env = to_rack(req) val = @app.call(env) resp = to_netty(val) future = e.getChannel.write(resp) listener = Object.new def listener.operationComplete(f) f.getChannel.close end future.addListener(listener) end |