Class: LanGrove::Handler::HttpServlet

Inherits:
EM::Connection
  • Object
show all
Includes:
EM::HttpServer, SocketBase
Defined in:
lib/langrove/handler/http_servlet.rb

Constant Summary

Constants included from LanGrove::Handler

Default

Instance Attribute Summary

Attributes included from LanGrove::Handler

#capsule, #config, #key, #logger, #pending_capsule, #protocol, #scheduler, #server, #type

Instance Method Summary collapse

Methods included from SocketBase

#handle_connect, #handle_disconnect, #handle_error, #handle_receive_data, #unbind

Methods included from LanGrove::Handler

#assign, #connect, #disconnect, #error, #event_filter, #receive, #reload, #reload_handler, #start, #start_handler, #stop, #stop_handler, #transform, #unique

Instance Method Details

#process_http_requestObject



40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/langrove/handler/http_servlet.rb', line 40

def process_http_request

  response = EM::DelegatedHttpResponse.new(self)

  @root.trigger( self, :handler, :request )

  request( response )

  response.send_response

  @root.trigger( self, :handler, :after_request )
  
end

#request(response) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/langrove/handler/http_servlet.rb', line 12

def request( response )

  #
  # OVERRIDE this
  #

  #
  # Available
  #
  #   @http_protocol
  #   @http_request_method
  #   @http_cookie
  #   @http_if_none_match
  #   @http_content_type
  #   @http_path_info
  #   @http_request_uri
  #   @http_query_string
  #   @http_post_content
  #   @http_headers
  # 

  response.content_type 'text/html'
  response.status = 200
  response.content = 'unimplemented'

end