Class: Asap::Netty::HttpResponseHandler
- Inherits:
-
Object
- Object
- Asap::Netty::HttpResponseHandler
- Defined in:
- lib/asap/netty/http_response_handler.rb
Instance Attribute Summary collapse
-
#callback ⇒ Object
readonly
Returns the value of attribute callback.
Instance Method Summary collapse
-
#initialize(callback) ⇒ HttpResponseHandler
constructor
A new instance of HttpResponseHandler.
- #messageReceived(ctxt, e) ⇒ Object
Constructor Details
#initialize(callback) ⇒ HttpResponseHandler
Returns a new instance of HttpResponseHandler.
6 7 8 9 |
# File 'lib/asap/netty/http_response_handler.rb', line 6 def initialize(callback) super() @callback = callback end |
Instance Attribute Details
#callback ⇒ Object (readonly)
Returns the value of attribute callback.
4 5 6 |
# File 'lib/asap/netty/http_response_handler.rb', line 4 def callback @callback end |
Instance Method Details
#messageReceived(ctxt, e) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/asap/netty/http_response_handler.rb', line 11 def (ctxt, e) response = e. if response.get_status.get_code == 200 callback.call(response.get_content.to_string(org.jboss.netty.util.CharsetUtil::UTF_8)) else raise "Request failed with #{response.get_status.get_code}" end end |