C# Class EdjCase.JsonRpc.Router.RpcRouter

Router for Asp.Net to direct Http Rpc requests to the correct method, invoke it and return the proper response
Inheritance: IRouter
ファイルを表示 Open project: edjCase/JsonRpc

Private Properties

Property Type Description
SetErrorResponse System.Threading.Tasks.Task
SetResponse System.Threading.Tasks.Task

Public Methods

Method Description
GetVirtualPath ( VirtualPathContext context ) : VirtualPathData

Generates the virtual path data for the router

RouteAsync ( Microsoft.AspNetCore.Routing.RouteContext context ) : System.Threading.Tasks.Task

Takes a route/http contexts and attempts to parse, invoke, respond to an Rpc request

RpcRouter ( IOptions serverConfig, IRpcInvoker invoker, IRpcParser parser, IRpcCompressor compressor, ILogger logger, IRpcRouteProvider routeProvider ) : System

Private Methods

Method Description
SetErrorResponse ( Microsoft.AspNetCore.Routing.RouteContext context, RpcException exception ) : System.Threading.Tasks.Task

Sets the http response to the corresponding Rpc exception

SetResponse ( Microsoft.AspNetCore.Routing.RouteContext context, List responses, bool isBulkRequest, JsonSerializerSettings jsonSerializerSettings = null ) : System.Threading.Tasks.Task

Sets the http response with the given Rpc responses

Method Details

GetVirtualPath() public method

Generates the virtual path data for the router
public GetVirtualPath ( VirtualPathContext context ) : VirtualPathData
context VirtualPathContext Virtual path context
return VirtualPathData

RouteAsync() public method

Takes a route/http contexts and attempts to parse, invoke, respond to an Rpc request
public RouteAsync ( Microsoft.AspNetCore.Routing.RouteContext context ) : System.Threading.Tasks.Task
context Microsoft.AspNetCore.Routing.RouteContext Route context
return System.Threading.Tasks.Task

RpcRouter() public method

public RpcRouter ( IOptions serverConfig, IRpcInvoker invoker, IRpcParser parser, IRpcCompressor compressor, ILogger logger, IRpcRouteProvider routeProvider ) : System
serverConfig IOptions Configuration data for the server
invoker IRpcInvoker Component that invokes Rpc requests target methods and returns a response
parser IRpcParser Component that parses Http requests into Rpc requests
compressor IRpcCompressor Component that compresses Rpc responses
logger ILogger Component that logs actions from the router
routeProvider IRpcRouteProvider Provider that allows the retrieval of all configured routes
return System