private void OnEndRequest(object sender, EventArgs e) { ExTraceGlobals.ReportingWebServiceTracer.TraceDebug((long)this.GetHashCode(), "ReportingModule.OnEndRequest"); HttpApplication httpApplication = (HttpApplication)sender; HttpContext context = httpApplication.Context; ReportingVersion.WriteVersionInfoInResponse(context); ReportingModule.activeRequestsCounter.Decrement(); this.averageRequestTime.Stop(); RequestStatistics requestStatistics = HttpContext.Current.Items[RequestStatistics.RequestStatsKey] as RequestStatistics; if (requestStatistics != null) { requestStatistics.AddStatisticsDataPoint(RequestStatistics.RequestStatItem.RequestResponseTime, this.requestStartTime, DateTime.UtcNow); requestStatistics.AddExtendedStatisticsDataPoint("HTTPCODE", context.Response.StatusCode.ToString()); IPrincipal user = context.User; string text = context.Request.Headers["X-SourceCafeServer"]; ServerLogEvent logEvent = new ServerLogEvent((ActivityContext.ActivityId != null) ? ActivityContext.ActivityId.Value.ToString() : string.Empty, string.IsNullOrEmpty(text) ? string.Empty : text, requestStatistics); ServerLogger.Instance.LogEvent(logEvent); } if (this.activityScope != null && !this.activityScope.IsDisposed) { this.activityScope.End(); } ExTraceGlobals.ReportingWebServiceTracer.TraceDebug((long)this.GetHashCode(), "ReportingModule.OnEndRequest - End"); }
private static ReportingSchema GetReportingSchema() { HttpContext httpContext = HttpContext.Current; string currentReportingVersion = ReportingVersion.GetCurrentReportingVersion(httpContext); return(ReportingSchema.GetReportingSchema(currentReportingVersion)); }
public static ReportingSchema GetCurrentReportingSchema(HttpContext httpContext) { ReportingSchema schema = null; ElapsedTimeWatcher.Watch(RequestStatistics.RequestStatItem.GetReportingSchemaLatency, delegate { string currentReportingVersion = ReportingVersion.GetCurrentReportingVersion(httpContext); schema = ReportingSchema.GetReportingSchema(currentReportingVersion); }); return(schema); }
private string GetCacheKey() { HttpContext httpContext = HttpContext.Current; string currentReportingVersion = ReportingVersion.GetCurrentReportingVersion(httpContext); return(string.Format(CultureInfo.InvariantCulture, "Exchange_Reporting_Metadata_{0}_{1}", new object[] { RbacPrincipal.Current.CacheKeys[0], currentReportingVersion })); }
public static void InitializeService(DataServiceConfiguration config) { config.SetEntitySetAccessRule("*", 3); config.UseVerboseErrors = Global.GetAppSettingAsBool("IncludeVerboseErrorsInReponse", false); config.DataServiceBehavior.MaxProtocolVersion = 2; int num; if (!int.TryParse(ConfigurationManager.AppSettings["EntitysetPageSize"], out num)) { num = 1000; } config.SetEntitySetPageSize("*", num); config.AnnotationsBuilder = new Func <IEdmModel, IEnumerable <IEdmModel> >(ReportingService.BuildAnnotations); bool flag; bool.TryParse(ConfigurationManager.AppSettings[ReportingService.AppSettingEnableRwsVersionZeroKey], out flag); if (flag) { ReportingVersion.EnableVersionZero(); } }
public static string GetCurrentReportingVersion(HttpContext httpContext) { string text = (string)httpContext.Items["Exchange_RWS_Version"]; if (string.IsNullOrEmpty(text)) { bool flag = httpContext.Request.QueryString.AllKeys.Contains(ReportingVersion.QueryStringParameterName); bool flag2 = httpContext.Request.Headers.AllKeys.Contains(ReportingVersion.HttpHeaderName); if (flag && flag2) { ServiceDiagnostics.ThrowError(ReportingErrorCode.ErrorVersionAmbiguous, Strings.ErrorVersionAmbiguous); } else if (flag || flag2) { string version; if (flag) { version = httpContext.Request.QueryString[ReportingVersion.QueryStringParameterName]; ExTraceGlobals.ReportingWebServiceTracer.TraceDebug <string>(0L, "[ReportingVersion::GetVersion] Version in query string: {0}", text); } else { version = httpContext.Request.Headers[ReportingVersion.HttpHeaderName]; ExTraceGlobals.ReportingWebServiceTracer.TraceDebug <string>(0L, "[ReportingVersion::GetVersion] Version in header: {0}", text); } if (!ReportingVersion.IsVersionSupported(version, out text)) { ServiceDiagnostics.ThrowError(ReportingErrorCode.ErrorInvalidVersion, Strings.ErrorInvalidVersion); } } else { ExTraceGlobals.ReportingWebServiceTracer.TraceDebug <string>(0L, "[ReportingVersion::GetVersion] Use the latest version: {0}", ReportingVersion.LatestVersion); text = ReportingVersion.LatestVersion; } } ExTraceGlobals.ReportingWebServiceTracer.Information <string>(0L, "[ReportingVersion::GetVersion] Version: {0}", text); httpContext.Items["Exchange_RWS_Version"] = text; return(text); }