예제 #1
0
        public HttpDocument(HttpCallerInfoCollection callers, int port)
        {
            this.callers = callers;
            this.port    = port;

            #region 读取资源

            try
            {
                var assm           = this.GetType().Assembly;
                var helpStream     = assm.GetManifestResourceStream("MySoft.IoC.HttpServer.Template.help.htm");
                var helpitemStream = assm.GetManifestResourceStream("MySoft.IoC.HttpServer.Template.helpitem.htm");

                //读取主模板
                using (var helpReader = new StreamReader(helpStream))
                {
                    htmlTemplate = helpReader.ReadToEnd();
                }

                //读取子项模板
                using (var helpitemReader = new StreamReader(helpitemStream))
                {
                    itemTemplate = helpitemReader.ReadToEnd();
                }
            }
            catch
            {
                htmlTemplate = string.Empty;
                itemTemplate = string.Empty;
            }

            #endregion
        }
예제 #2
0
 /// <summary>
 /// HttpServiceCaller初始化
 /// </summary>
 /// <param name="group"></param>
 /// <param name="config"></param>
 /// <param name="container"></param>
 public HttpServiceCaller(IWorkItemsGroup group, CastleServiceConfiguration config, IServiceContainer container)
 {
     this.config       = config;
     this.container    = container;
     this.smart        = group;
     this.callers      = new HttpCallerInfoCollection();
     this.callTimeouts = new Dictionary <string, int>();
 }
예제 #3
0
        /// <summary>
        /// 获取Http方法
        /// </summary>
        /// <returns></returns>
        public string GetDocument(string name)
        {
            var dicCaller = new HttpCallerInfoCollection();

            if (!string.IsNullOrEmpty(name))
            {
                if (callers.ContainsKey(name))
                {
                    dicCaller[name] = callers[name];
                }
            }
            else
            {
                dicCaller = callers;
            }

            var doc = new HttpDocument(dicCaller, config.HttpPort);

            return(doc.MakeDocument(name));
        }