Class: Reacter::HttpAdapter::HttpHandler
- Inherits:
-
EM::HttpServer::Server
- Object
- EM::HttpServer::Server
- Reacter::HttpAdapter::HttpHandler
- Defined in:
- lib/reacter/adapters/http.rb
Instance Method Summary collapse
-
#initialize(*args) ⇒ HttpHandler
constructor
A new instance of HttpHandler.
- #process_http_request ⇒ Object
Constructor Details
#initialize(*args) ⇒ HttpHandler
Returns a new instance of HttpHandler.
13 14 15 16 |
# File 'lib/reacter/adapters/http.rb', line 13 def initialize(*args) super @callback = args.first end |
Instance Method Details
#process_http_request ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/reacter/adapters/http.rb', line 18 def process_http_request() begin @callback.call({ :method => @http_request_method.to_sym, :host => @http[:host], :path => @http_request_uri, :headers => @http, :body => @http_content, :query => Hash[(@http_query_string || '').split('&').collect{|i| i = i.split('=') [i[0], i[1]] }], }) rescue Exception => e puts e end response = EM::DelegatedHttpResponse.new(self) response.status = 200 response.send_response() end |