Newer
Older
weather-servlet / src / main / scala / bootstrap / liftweb / Boot.scala
package bootstrap.liftweb

import net.liftweb.util._
import net.liftweb.http._
import net.liftweb.sitemap._
import net.liftweb.sitemap.Loc._
import Helpers._

import uk.org.floop.msc.wview.DataCollector
import uk.org.floop.msc.rest.Graph
 
/**
  * A class that's instantiated early and run.  It allows the application
  * to modify lift's environment
  */
class Boot {
  def boot {
    // where to search snippet
    LiftRules.addToPackages("uk.org.floop.msc")     

    val apiDispatcher: LiftRules.DispatchPf = {  
      case RequestMatcher(RequestState("graph" :: args, _) ,_) => graphApi(args)  
    } 
    LiftRules.statelessDispatchTable =   
      apiDispatcher orElse LiftRules.statelessDispatchTable  
    DataCollector.start()
  }
  
  private def graphApi  
    (args: List[String])
    (req: RequestState): Can[ResponseIt] =  
    Graph(args)

}