public RailsEngineContextAdapter(HttpContext context, String url) { _url = url; _context = context; _request = new RequestAdapter(context.Request); _trace = new TraceAdapter(context.Trace); _response = new ResponseAdapter(context.Response, _url, ApplicationPath); _server = new ServerUtilityAdapter(context.Server); }
/// <summary> /// Initializes a new instance of the <see cref="DefaultRailsEngineContext"/> class. /// </summary> /// <param name="parent">The parent.</param> /// <param name="urlInfo">Url information</param> /// <param name="context">The context.</param> /// <param name="container">External container instance</param> public DefaultRailsEngineContext(IServiceContainer parent, UrlInfo urlInfo, HttpContext context, IServiceProvider container) : base(parent) { _urlInfo = urlInfo; _context = context; _request = new RequestAdapter(context.Request); _trace = new TraceAdapter(context.Trace); _server = new ServerUtilityAdapter(context.Server); _response = new ResponseAdapter(context.Response, this, ApplicationPath); _url = _context.Request.RawUrl; _cache = parent.GetService(typeof(ICacheProvider)) as ICacheProvider; this.container = container; }
/// <summary> /// Pendent. /// </summary> /// <param name="container"></param> /// <param name="urlInfo"></param> /// <param name="context"></param> /// <param name="routeMatch"></param> /// <returns></returns> public IEngineContext Create(IMonoRailContainer container, UrlInfo urlInfo, HttpContext context, RouteMatch routeMatch) { var session = ResolveRequestSession(container, urlInfo, context); var urlBuilder = container.UrlBuilder; var serverUtility = new ServerUtilityAdapter(context.Server); var referrer = context.Request.Headers["Referer"]; return new DefaultEngineContext(container, urlInfo, context, serverUtility, new RequestAdapter(context.Request), new ResponseAdapter(context.Response, urlInfo, urlBuilder, serverUtility, routeMatch, referrer), new TraceAdapter(context.Trace), session); }