Example #1
0
        protected virtual void RegisterRoutes()
        {
            var routes  = RouteTable.Routes;
            var handler = new RunnerHandler(RoutePath, Assemblies, ResultPath);

            using (routes.GetWriteLock())
            {
                var defaultRoute = new Route(RoutePath + "/", handler)
                {
                    // we have to specify these, so no MVC route helpers will match, e.g. @Html.ActionLink("Home", "Index", "Home")
                    Defaults    = new RouteValueDictionary(new { controller = "RunnerHandler", action = "ProcessRequest" }),
                    Constraints = new RouteValueDictionary(new { controller = "RunnerHandler", action = "ProcessRequest" })
                };

                routes.Add("RouteName", defaultRoute);

                var filenameRoute = new Route(RoutePath + "/{filename}", handler)
                {
                    Defaults    = new RouteValueDictionary(new { controller = "RunnerHandler", action = "ProcessRequest" }),
                    Constraints = new RouteValueDictionary(new { controller = "RunnerHandler", action = "ProcessRequest" })
                };

                routes.Add(RouteName + "Files", filenameRoute);
            }
        }
Example #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="handler">handler the handler to notify of started and stopped events.</param>
 public void SetHandler(RunnerHandler handler)
 {
     this.handler = handler;
 }