Пример #1
0
 /// <summary>
 /// Processes an incoming HTTP request to the correct configured
 /// OData SPARQL service endpoint
 /// </summary>
 /// <param name="context"></param>
 public void ProcessRequest(HttpContext context)
 {
     HttpRequest request = context.Request;
     var pathSegments = request.Path.Split('/');
     ODataSparqlServiceSettings serviceSettings = null;
     var baseUriBuilder = new StringBuilder();
     foreach (var pathSegment in pathSegments)
     {
         baseUriBuilder.Append(pathSegment);
         baseUriBuilder.Append('/');
         if (pathSegment.EndsWith(".sparql"))
         {
             var serviceName = pathSegment.Substring(0, pathSegment.LastIndexOf('.'));
             serviceSettings = AssertContext(serviceName, context);
             break;
         }
     }
     
     var handler = new ODataSparqlRequestHandler(serviceSettings);
     handler.ProcessRequest(context, new Uri(context.Request.Url, baseUriBuilder.ToString()));
 }
Пример #2
0
        /// <summary>
        /// Processes an incoming HTTP request to the correct configured
        /// OData SPARQL service endpoint
        /// </summary>
        /// <param name="context"></param>
        public void ProcessRequest(HttpContext context)
        {
            HttpRequest request      = context.Request;
            var         pathSegments = request.Path.Split('/');
            ODataSparqlServiceSettings serviceSettings = null;
            var baseUriBuilder = new StringBuilder();

            foreach (var pathSegment in pathSegments)
            {
                baseUriBuilder.Append(pathSegment);
                baseUriBuilder.Append('/');
                if (pathSegment.EndsWith(".sparql"))
                {
                    var serviceName = pathSegment.Substring(0, pathSegment.LastIndexOf('.'));
                    serviceSettings = AssertContext(serviceName, context);
                    break;
                }
            }

            var handler = new ODataSparqlRequestHandler(serviceSettings);

            handler.ProcessRequest(context, new Uri(context.Request.Url, baseUriBuilder.ToString()));
        }