示例#1
0
 internal static Response ToResponse(
     IObjectResponse objectResponse,
     Request request,
     MediaTypeMapper mediaTypeMapper,
     IErrorHandler errorHandler,
     ILogger logger)
 => Success.Of <Exception, Response>(objectResponse.ResponseFrom(request, mediaTypeMapper))
 .Resolve(
     ex => ResourceErrorProcessor.ResourceHandlerError(errorHandler, logger, ex),
     response => response);
示例#2
0
 public RequestHandler2 <T, R> Body <R>(MediaTypeMapper mediaTypeMapper)
 {
     MediaTypeMapper = mediaTypeMapper;
     return(new RequestHandler2 <T, R>(
                Method,
                Path,
                Resolver,
                ParameterResolver.Body <R>(mediaTypeMapper),
                ErrorHandler,
                mediaTypeMapper));
 }
示例#3
0
 public RequestHandler3 <T, TR, TU> Body <TU>(MediaTypeMapper mediaTypeMapper)
 {
     MediaTypeMapper = mediaTypeMapper;
     return(new RequestHandler3 <T, TR, TU>(
                Method,
                Path,
                ResolverParam1,
                ResolverParam2,
                ParameterResolver.Body <TU>(mediaTypeMapper),
                ErrorHandler,
                MediaTypeMapper));
 }
示例#4
0
 internal RequestHandler2(
     Method method,
     string path,
     ParameterResolver <T> resolverParam1,
     ParameterResolver <TR> resolverParam2,
     IErrorHandler errorHandler,
     MediaTypeMapper mediaTypeMapper)
     : base(method, path, new List <IParameterResolver> {
     resolverParam1, resolverParam2
 }, errorHandler, mediaTypeMapper)
 {
     ResolverParam1 = resolverParam1;
     ResolverParam2 = resolverParam2;
 }
示例#5
0
 internal static ICompletes <Response> ExecuteRequest(
     Request request,
     MediaTypeMapper mediaTypeMapper,
     Func <ICompletes <IObjectResponse> > executeAction,
     IErrorHandler errorHandler,
     ILogger logger)
 {
     try
     {
         return(executeAction.Invoke()
                .AndThen(objectResponse => ToResponse(objectResponse, request, mediaTypeMapper, errorHandler, logger)));
     }
     catch (Exception ex)
     {
         return(Completes.WithFailure(ResourceErrorProcessor.ResourceHandlerError(errorHandler, logger, ex)));
     }
 }
示例#6
0
 internal RequestHandler5(
     Method method,
     string path,
     ParameterResolver <T> resolverParam1,
     ParameterResolver <TR> resolverParam2,
     ParameterResolver <TU> resolverParam3,
     ParameterResolver <TI> resolverParam4,
     ParameterResolver <TJ> resolverParam5,
     IErrorHandler errorHandler,
     MediaTypeMapper mediaTypeMapper)
     : base(method, path, new List <IParameterResolver> {
     resolverParam1, resolverParam2, resolverParam3, resolverParam4, resolverParam5
 }, errorHandler, mediaTypeMapper)
 {
     ResolverParam1 = resolverParam1;
     ResolverParam2 = resolverParam2;
     ResolverParam3 = resolverParam3;
     ResolverParam4 = resolverParam4;
     ResolverParam5 = resolverParam5;
 }