require 'global_application.rb' class GlobalWebServerAppe pp e,e.backtrace raise end rescue HTTPController::UnknownAction=>e puts "TRY FIND FILE" # try to find a file path=func.to_s path.gsub!(/^(\.\.\/)*/,"") raise e unless l.render_static(res,path) end return [res.content_type,res.body] end def add(app,controller,url,instance) @servlets << Servlet.new(app,controller,url) offer([:global_web,[app.getAppName,instance]]) end def offerInstance(instance) #@servlets << Servlet.new(app,controller,url) offer([:global_web,[instance]]) end private def getController(req) #exit #FIXME instance=req.instance app=cluster.getApp(instance.instanceType) funcs=req.path_info.split("/")[2..-1] func=funcs.join("/") if funcs func||="" controller=app.getController(:urlPart=>func) controller||=app.mainController return s=Servlet.new(app,controller.filePath,"") #Servlet=Struct.new(:application,:controller,:url) @servlets.select{|servlet| pp "SERVLET ",servlet.url,"REQPATH",req.path req.path=~/^#{servlet.url}(\/.*)?$/ }[0] end end