Bundling.Extensions.Handlers.BundleHttpHandler.ProcessRequest C# (CSharp) Method

ProcessRequest() public method

public ProcessRequest ( HttpContext context ) : void
context System.Web.HttpContext
return void
		public void ProcessRequest(HttpContext context)
		{
			var routeData = context.Items["RouteData"] as RouteData;

			Assert.ArgumentNotNull(routeData, "routeData");

			var timestamp = routeData.Values["timestamp"].ToString();
			string filepath = (routeData.Values["filepath"] ?? string.Empty).ToString();

			var contextBase = (HttpContextBase)new HttpContextWrapper(context);
			var bundleUrl =
				VirtualPathUtility.ToAppRelative(
					context.Request.Url.AbsolutePath.Substring(
						0, context.Request.Url.AbsolutePath.IndexOf(timestamp, StringComparison.Ordinal) - 1));
			Bundle bundle = BundleTable.Bundles.GetBundleFor(bundleUrl) ?? BundleTable.Bundles.GetBundleFor(bundleUrl + "/");
			var bundleContext = new BundleContext(contextBase, BundleTable.Bundles, bundle.Path);
			BundleResponse bundleResponse = string.IsNullOrEmpty(filepath)
												? this.GetBundleResponse(bundle, bundleContext)
												: this.GetSingleFileBundleResponse(bundle, bundleContext, filepath);

			this.SetBundleHeaders(bundleResponse, bundleContext);
			context.Response.Write(bundleResponse.Content);
		}