Beispiel #1
0
        private bool handlePost(string requestUrl, Dictionary <string, string> param, string data)
        {
            if (null != dispatcher)
            {
                string command = (requestUrl.StartsWith("/")) ? requestUrl.Substring(1) : requestUrl;

                Object result = dispatcher.dispatch(command, data);

                if (null != result)
                {
                    if (result is string)
                    {
                        sendResponse((string)result, "text/text; charset=utf-8");
                        // Console.WriteLine("POST successfull: " + requestUrl + "/" + data);
                    }
                    else if (result is byte[])
                    {
                        sendResponse((byte[])result, "application/octet-stream");
                        // Console.WriteLine("POST successfull: " + requestUrl + "/ binary response");
                    }
                }
            }

            return(true);
        }