コード例 #1
0
        public HttpPipe[] GetPipesInChain(string chainid)
        {
            if (this.pipesChains.ContainsKey(chainid))
            {
                ChainObject[]         chainObjects = this.pipesChains[chainid];
                LinkedList <HttpPipe> pipes        = new LinkedList <HttpPipe>();

                for (int i = 0; i < chainObjects.Length; i++)
                {
                    if (chainObjects[i].ObjectType == ChainObjectType.Pipe)
                    {
                        pipes.AddLast(httpPipesRepository.GetPipeInstance(chainObjects[i].ObjectId, this));
                    }
                    else if (chainObjects[i].ObjectType == ChainObjectType.Chain)
                    {
                        HttpPipe[] morePipes = GetPipesInChain(chainObjects[i].ObjectId);
                        foreach (HttpPipe np in morePipes)
                        {
                            pipes.AddLast(np);
                        }
                    }
                }

                HttpPipe[] pipesArr = new HttpPipe[pipes.Count];
                pipes.CopyTo(pipesArr, 0);


                return(pipesArr);
            }
            return(null);
        }
コード例 #2
0
        public virtual void Flush()
        {
            if (IsClosed)
            {
                return;
            }
            HttpPipe nextPipe = this.PipesChain.GetNextPipe(this);

            if (nextPipe != null)
            {
                nextPipe.Flush();
            }
        }
コード例 #3
0
        public virtual void SendData(byte[] buffer, int offset, int length)
        {
            if (IsClosed)
            {
                return;
            }
            HttpPipe nextPipe = this.PipesChain.GetNextPipe(this);

            if (nextPipe != null)
            {
                nextPipe.SendData(buffer, offset, length);
            }
        }
コード例 #4
0
        public virtual void StartReceive()
        {
            if (isClosed)
            {
                return;
            }
            HttpPipe nextPipe = this.PipesChain.GetNextPipe(this);

            if (nextPipe != null)
            {
                nextPipe.StartReceive();
            }
        }
コード例 #5
0
        public virtual void HandleError(Exception e)
        {
            if (IsClosed)
            {
                return;
            }
            HttpPipe nextPipe = this.PipesChain.GetNextPipe(this);

            if (nextPipe != null)
            {
                nextPipe.HandleError(e);
            }
        }
コード例 #6
0
        public HttpPipe GetPipeInstance(String pipeName, HttpPipesChainsFactory httpPipesChainsFactory)
        {
            if (!availablePipes.ContainsKey(pipeName))
            {
                throw new HttpPipeNotFoundException();
            }

            HttpPipeMeta mi           = availablePipes[pipeName];
            Assembly     pipeAssembly = null;

            if (String.IsNullOrEmpty(mi.Assembly) == false)
            {
                String location = mi.Assembly;

                if (File.Exists(location) == false)
                {
                    location = (Path.GetDirectoryName(Assembly.GetAssembly(typeof(HttpPipesRepository)).Location).Replace("\\", "/") + "/" + location);
                }
                if (File.Exists(location))
                {
                    pipeAssembly = Assembly.LoadFrom(location);
                }
            }

            if (pipeAssembly == null)
            {
                pipeAssembly = Assembly.GetAssembly(typeof(HttpPipesRepository));
            }

            HttpPipe pipe = (HttpPipe)pipeAssembly.CreateInstance(mi.Classname);

            pipe.Configuration = this.config;
            pipe.ChainsFactory = httpPipesChainsFactory;
            pipe.Init(mi.Config);

            return(pipe);
        }