1Static <- setRefClass( 2 'Static', 3 'contains' = 'Middleware', 4 fields = c('urls','file_server'), 5 methods = list( 6 initialize = function(urls=c(),root=pwd(),...){ 7 urls <<- paste('^',urls,sep='') 8 file_server <<- Rook::File$new(root) 9 callSuper(...) 10 }, 11 call = function(env){ 12 path <- env[["PATH_INFO"]] 13 if (any(sapply(urls,function(i)length(grep(i,path))>0))) 14 file_server$call(env) 15 else 16 app$call(env) 17 } 18 ) 19) 20