Inheritance: IRequestProcessorPipeline
コード例 #1
0
ファイル: PomonaSessionFactory.cs プロジェクト: Pomona/Pomona
 public PomonaSessionFactory(TypeMapper typeMapper, Route routes, IRouteActionResolver actionResolver)
 {
     TypeMapper = typeMapper;
     ActionResolver = actionResolver;
     Routes = routes;
     this.pipeline = new DefaultRequestProcessorPipeline();
     this.serializerFactory = new PomonaJsonSerializerFactory();
 }
コード例 #2
0
ファイル: PomonaModule.cs プロジェクト: BeeWarloc/Pomona
        private PomonaResponse GetResource()
        {
            var pathNodes = GetPathNodes();
            var rootNode = new DataSourceRootNode(TypeMapper, this.dataSource);
            PathNode node = rootNode;
            foreach (var pathPart in pathNodes.WalkTree(x => x.Next).Skip(1).Select(x => x.Value))
                node = node.GetChildNode(pathPart);

            var pomonaRequest = new PomonaRequest(node,
                Context,
                new PomonaJsonSerializerFactory(Context.GetSerializationContextProvider()));

            if (!node.AllowedMethods.HasFlag(pomonaRequest.Method))
                ThrowMethodNotAllowedForType(node.AllowedMethods);

            var response = new DefaultRequestProcessorPipeline().Process(pomonaRequest);
            if (response == null)
                throw new PomonaException("Unable to find RequestProcessor able to handle request.");
            return response;
        }