protected HttpRequestHandler()
 {
     _methodSelector = new DispatchMethodSelector <HttpRequestData>(this, (ref HttpRequestData source, out string key) =>
     {
         key = source.Path;
     });
 }
Esempio n. 2
0
        public void SetMethodSelectHandler(object targetInstance, DispatchMethodSelector <StreamBuffer> .MethodSelectHandler handler)
        {
            if (handler == null)
            {
                return;
            }

            _methodSelector = new DispatchMethodSelector <StreamBuffer>(targetInstance, handler);
        }
Esempio n. 3
0
        protected RequestHandler()
        {
            _methodSelector = new DispatchMethodSelector <RequestHandlerArgument>(this, (ref RequestHandlerArgument source, out string key) =>
            {
                try
                {
                    JToken jobject = JToken.Parse(source.MessageBody);
                    key            = ((string)(jobject["cmd"])).Trim();
                }
                catch (Exception)
                {
                    throw new AegisException(RoseResult.InvalidReqest);
                }

                if (_methodSelector.HasMethodWithKey(key) == false)
                {
                    throw new AegisException(RoseResult.UnknownCommand);
                }
            });
        }
Esempio n. 4
0
        public void SetMethodSelectHandler(object targetInstance, DispatchMethodSelector<StreamBuffer>.MethodSelectHandler handler)
        {
            if (handler == null)
                return;

            _methodSelector = new DispatchMethodSelector<StreamBuffer>(targetInstance, handler);
        }