Class: Jettr::Handler::SimpleHandler

Inherits:
Base
  • Object
show all
Defined in:
lib/jettr/handler/simple_handler.rb

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ SimpleHandler

Returns a new instance of SimpleHandler.



4
5
6
7
# File 'lib/jettr/handler/simple_handler.rb', line 4

def initialize(response)
  super()
  @response = response
end

Instance Method Details

#handle(target, request, response, dispatch) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/jettr/handler/simple_handler.rb', line 9

def handle(target, request, response, dispatch)
  puts "Handling request for: #{[target,request,response,dispatch].inspect}"
  response.content_type = "text/html;charset=utf-8"
  response.status = 200
    
  response.get_writer.println(@response)
  request.handled = true
end