/// <summary> /// Performs the base work of MonoRail. Extracts /// the information from the URL, obtain the controller /// that matches this information and dispatch the execution /// to it. /// </summary> /// <param name="context"></param> public virtual void Process(IRailsEngineContext context) { UrlInfo info = ExtractUrlInfo(context); Controller controller = controllerFactory.CreateController(info); if (controller == null) { String message = String.Format("No controller for {0}\\{1}", info.Area, info.Controller); throw new RailsException(message); } try { controller.Process(context, this, info.Area, info.Controller, info.Action); } finally { controllerFactory.Release(controller); // Remove items from flash before leaving the page context.Flash.Sweep(); if (context.Flash.HasItemsToKeep) { context.Session[Flash.FlashKey] = context.Flash; } else if (context.Session.Contains(Flash.FlashKey)) { context.Session.Remove(Flash.FlashKey); } } }