Class Atchoum::Handler
In: lib/atchoum/server.rb
Parent: WEBrick::HTTPServlet::DefaultFileHandler

Handler of every requests beeing made to the web server. URLs ending with / are threated as dynamic calls to the Website pages, other are served as normal static files.

Methods

new   service  

Public Class methods

[Source]

    # File lib/atchoum/server.rb, line 32
32:     def initialize(server, script)
33:       super(server, script)
34:       @reloader = Reloader.new(script)
35:       @reloader.reload
36:     end

Public Instance methods

[Source]

    # File lib/atchoum/server.rb, line 38
38:     def service(req, resp)
39:       @reloader.reload
40:       if /(\w*)\/$/ =~ req.path
41:         render resp, $1
42:       else
43:         @local_path = Dir::pwd + "/#{req.path}"
44:         if File.exist? @local_path
45:           do_GET(req, resp)
46:         else
47:           status = 404
48:         end
49:       end
50:     end

[Validate]