Пример #1
0
        private void OnGetInfo(Beetle.IChannel channel, string appname, IProperties properties)
        {
            HttpHeader  result;
            TrackerInfo info;

            byte[]             data;
            BytesReader        reader;
            HttpBody           body;
            IAppTrackerHandler appHandler = GetAppHandler(appname);

            if (appHandler == null)
            {
                result        = new HttpHeader();
                result.Action = "500 " + string.Format("{0} Tracker Handler Notfound", appname);
                channel.Send(result);
            }
            else
            {
                info          = appHandler.GetInfo(properties);
                data          = Encoding.UTF8.GetBytes(info.Data);
                result        = new HttpHeader();
                result.Action = "200";
                result.Length = data.Length;
                result[Protocol.HEADER_INFOTYPE] = info.TypeName;
                channel.Send(result);
                reader = new BytesReader(data, 0, data.Length);
                while (reader.Read())
                {
                    body = HttpPacket.InstanceBodyData();
                    reader.ReadTo(body);
                    channel.Send(body);
                }
            }
        }