Exemplo n.º 1
0
        } //end Route()

        /// <summary>Returns the appropriate number for its respective path by
        ///             going down the Chain of Responsibility until either the paths match
        ///             or the chain ends</summary>
        public int HandleRequest(Request request)
        {
            if (path == request.path)
            {
                return(Handler(request.payload));
            }
            else if (next != null)
            {
                return(next.HandleRequest(request));
            }
            return(404);
        }
Exemplo n.º 2
0
        public int HandleRequest(Request r)
        {
            if (Path == r.Route)
            {
                return(Handle(r.Payload));
            }

            if (Next != null)
            {
                return(Next.HandleRequest(r));
            }

            // If neither this nor the next Route can handle the request,
            // return 404 by default
            return(404);
        }
Exemplo n.º 3
0
 public int Execute(Route route)
 {
     return(route.HandleRequest(this));
 }