/// <summary> /// Response to the request /// </summary> /// <param name="context"></param> /// <param name="rpcService"></param> /// <param name="provider"></param> /// <returns></returns> public async Task Invoke(HttpContext context, IXmlRpcService rpcService, IMetaWeblogEndpointProvider provider) { var scopeFactory = serviceProvider.GetRequiredService <IServiceScopeFactory>(); var xmlRpcContext = new XmlRpcContext(context, Options?.Value, new Dictionary <string, string>(), serviceProvider, scopeFactory, new Type[] { rpcService.GetType() }); if (context.Request.Path.StartsWithSegments(xmlRpcContext.Options.SummaryEndpoint) || context.Request.Path.StartsWithSegments(xmlRpcContext.Options.Endpoint) || context.Request.Path.StartsWithSegments(xmlRpcContext.Options.RsdEndpoint) || context.Request.Path.StartsWithSegments(xmlRpcContext.Options.ManifestEndpoint) ) { // Add blog id into the context. xmlRpcContext.Values.Add(Options?.Value.BlogIdTokenName, context.Request.Path.ExtractBlogId()); var result = await provider.ProcessAsync(xmlRpcContext); if (result) { return; } } await next.Invoke(context); }
/// <summary> /// Initializes a new instance of <see cref="XmlRpcServiceContext"/>. /// </summary> /// <param name="xmlRpcService"></param> /// <param name="inputStream"></param> /// <param name="outputStream"></param> public XmlRpcServiceContext(IXmlRpcService xmlRpcService, Stream inputStream, Stream outputStream) { this.xmlRpcService = xmlRpcService; this.inputStream = inputStream; this.outputStream = outputStream; }
/// <summary> /// Invokes the current XML-RPC Service Method. /// </summary> /// <param name="xmlRpcService"></param> /// <param name="parameters"></param> /// <returns></returns> public object Invoke(IXmlRpcService xmlRpcService, object[] parameters) { return(methodInfo.Invoke(xmlRpcService, parameters)); }