• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# EntityManagement.HttpEntityManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中EventStore.Transport.Http.EntityManagement.HttpEntityManager的典型用法代码示例。如果您正苦于以下问题:C# HttpEntityManager类的具体用法?C# HttpEntityManager怎么用?C# HttpEntityManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



HttpEntityManager类属于EventStore.Transport.Http.EntityManagement命名空间,在下文中一共展示了HttpEntityManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Test1Handler

 private void Test1Handler(HttpEntityManager http, UriTemplateMatch match)
 {
     if (http.User != null) 
         http.Reply("OK", 200, "OK", "text/plain");
     else 
         http.Reply("Please authenticate yourself", 401, "Unauthorized", "text/plain");
 }
开发者ID:kijanawoodard,项目名称:EventStore,代码行数:7,代码来源:TestController.cs


示例2: TestEncodingHandler

        private void TestEncodingHandler(HttpEntityManager http, UriTemplateMatch match)
        {
            var a = match.BoundVariables["a"];
            var b = match.BoundVariables["b"];

            http.Reply(new { a = a, b = b, rawSegment = http.RequestedUrl.Segments[2] }.ToJson(), 200, "OK", "application/json");
        }
开发者ID:kijanawoodard,项目名称:EventStore,代码行数:7,代码来源:TestController.cs


示例3: TestAnonymousHandler

 private void TestAnonymousHandler(HttpEntityManager http, UriTemplateMatch match)
 {
     if (http.User != null)
         http.Reply("ERROR", 500, "ERROR", "text/plain");
     else 
         http.Reply("OK", 200, "OK", "text/plain");
 }
开发者ID:kijanawoodard,项目名称:EventStore,代码行数:7,代码来源:TestController.cs


示例4: SendOk

 protected RequestParams SendOk(HttpEntityManager httpEntityManager)
 {
     httpEntityManager.ReplyStatus(HttpStatusCode.OK,
                                   "OK",
                                   e => Log.Debug("Error while closing http connection (ok): {0}.", e.Message));
     return new RequestParams(done: true);
 }
开发者ID:kijanawoodard,项目名称:EventStore,代码行数:7,代码来源:CommunicationController.cs


示例5: SendBadRequest

 protected RequestParams SendBadRequest(HttpEntityManager httpEntityManager, string reason)
 {
     httpEntityManager.ReplyStatus(HttpStatusCode.BadRequest,
                                   reason,
                                   e => Log.Debug("Error while closing http connection (bad request): {0}.", e.Message));
     return new RequestParams(done: true);
 }
开发者ID:kijanawoodard,项目名称:EventStore,代码行数:7,代码来源:CommunicationController.cs


示例6: SendTooBig

 protected RequestParams SendTooBig(HttpEntityManager httpEntityManager)
 {
     httpEntityManager.ReplyStatus(HttpStatusCode.RequestEntityTooLarge,
                                   "Too large events received. Limit is 4mb",
                                   e => Log.Debug("Too large events received over HTTP"));
     return new RequestParams(done: true);
 }
开发者ID:danieldeb,项目名称:EventStore,代码行数:7,代码来源:CommunicationController.cs


示例7: HttpEntity

        public HttpEntity(DateTime timeStamp,
                          ICodec requestCodec,
                          ICodec responseCodec,
                          HttpListenerContext context,
                          string[] allowedMethods,
                          Action<HttpEntity> onRequestSatisfied)
        {
            Ensure.NotNull(requestCodec, "requestCodec");
            Ensure.NotNull(responseCodec, "responseCodec");
            Ensure.NotNull(context, "context");
            Ensure.NotNull(allowedMethods, "allowedMethods");
            Ensure.NotNull(onRequestSatisfied, "onRequestSatisfied");

            TimeStamp = timeStamp;
            UserHostName = context.Request.UserHostName;

            RequestCodec = requestCodec;
            ResponseCodec = responseCodec;
            _context = context;

            Request = context.Request;
            Response = context.Response;

            Manager = new HttpEntityManager(this, allowedMethods, onRequestSatisfied);
        }
开发者ID:base31,项目名称:geteventstore_EventStore,代码行数:25,代码来源:HttpEntity.cs


示例8: OnGetFreshStats

        private void OnGetFreshStats(HttpEntityManager entity, UriTemplateMatch match)
        {
            var envelope = new SendToHttpEnvelope(_networkSendQueue,
                                                  entity,
                                                  Format.GetFreshStatsCompleted,
                                                  Configure.GetFreshStatsCompleted);

            var statPath = match.BoundVariables["statPath"];
            var statSelector = GetStatSelector(statPath);

            bool useMetadata;
            if (!bool.TryParse(match.QueryParameters["metadata"], out useMetadata))
                useMetadata = false;

            bool useGrouping;
            if (!bool.TryParse(match.QueryParameters["group"], out useGrouping))
                useGrouping = true;

            if (!useGrouping && !string.IsNullOrEmpty(statPath))
            {
                SendBadRequest(entity, "Dynamic stats selection works only with grouping enabled");
                return;
            }
             
            Publish(new MonitoringMessage.GetFreshStats(envelope, statSelector, useMetadata, useGrouping));
        }
开发者ID:Kristinn-Stefansson,项目名称:EventStore,代码行数:26,代码来源:StatController.cs


示例9: AckMessages

        private void AckMessages(HttpEntityManager http, UriTemplateMatch match)
        {
            var envelope = new NoopEnvelope();
            var groupname = match.BoundVariables["subscription"];
            var stream = match.BoundVariables["stream"];
            var messageIds = match.BoundVariables["messageIds"];
            var ids = new List<Guid>();
            foreach (var messageId in messageIds.Split(new[] { ',' }))
            {
                Guid id;
                if (!Guid.TryParse(messageId, out id))
                {
                    http.ReplyStatus(HttpStatusCode.BadRequest, "messageid should be a properly formed guid", exception => { });
                    return;
                }
                ids.Add(id);
            }

            var cmd = new ClientMessage.PersistentSubscriptionAckEvents(
                                             Guid.NewGuid(),
                                             Guid.NewGuid(),
                                             envelope,
                                             BuildSubscriptionGroupKey(stream, groupname),
                                             ids.ToArray(),
                                             http.User);
            Publish(cmd);
            http.ReplyStatus(HttpStatusCode.Accepted, "", exception => { });
        }
开发者ID:EventStore,项目名称:EventStore,代码行数:28,代码来源:PersistentSubscriptionController.cs


示例10: OnGetTcpConnectionStats

 private void OnGetTcpConnectionStats(HttpEntityManager entity, UriTemplateMatch match)
 {
     var envelope = new SendToHttpEnvelope(_networkSendQueue,
                                           entity,
                                           Format.GetFreshTcpConnectionStatsCompleted,
                                           Configure.GetFreshTcpConnectionStatsCompleted);
     Publish(new MonitoringMessage.GetFreshTcpConnectionStats(envelope));
 }
开发者ID:SzymonPobiega,项目名称:EventStore,代码行数:8,代码来源:StatController.cs


示例11: HttpSend

 public HttpSend(
     HttpEntityManager httpEntityManager, ResponseConfiguration configuration, string data, Message message)
     : base(Guid.Empty, null, httpEntityManager)
 {
     Data = data;
     Configuration = configuration;
     Message = message;
 }
开发者ID:danieldeb,项目名称:EventStore,代码行数:8,代码来源:HttpMessage.cs


示例12: ReplyWithContent

        private void ReplyWithContent(HttpEntityManager http, string contentLocalPath)
        {
            //NOTE: this is fix for Mono incompatibility in UriTemplate behavior for /a/b{*C}
            if (("/" + contentLocalPath).StartsWith(_localWebRootPath))
                contentLocalPath = contentLocalPath.Substring(_localWebRootPath.Length);

            //_logger.Trace("{0} requested from MiniWeb", contentLocalPath);
            try
            {
                var extensionToContentType = new Dictionary<string, string>
                {
                    { ".png",  "image/png"} ,
                    { ".svg",  "image/svg+xml"} ,
                    { ".woff", "application/x-font-woff"} ,
                    { ".woff2", "application/x-font-woff"} ,
                    { ".ttf", "application/font-sfnt"} ,
                    { ".jpg",  "image/jpeg"} ,
                    { ".jpeg", "image/jpeg"} ,
                    { ".css",  "text/css"} ,
                    { ".htm",  "text/html"} ,
                    { ".html", "text/html"} ,
                    { ".js",   "application/javascript"} ,
                    { ".json",   "application/json"} ,
                    { ".ico",  "image/vnd.microsoft.icon"}
                };

                var extension = Path.GetExtension(contentLocalPath);
                var fullPath = Path.Combine(_fileSystemRoot, contentLocalPath);

                string contentType;
                if (string.IsNullOrEmpty(extension)
                    || !extensionToContentType.TryGetValue(extension.ToLower(), out contentType)
                    || !File.Exists(fullPath))
                {
                    _logger.Info("Replying 404 for {0} ==> {1}", contentLocalPath, fullPath);
                    http.ReplyTextContent(
                        "Not Found", 404, "Not Found", "text/plain", null,
                        ex => _logger.InfoException(ex, "Error while replying from MiniWeb"));
                }
                else
                {
                    var config = GetWebPageConfig(contentType);
                    var content = File.ReadAllBytes(fullPath);

                    http.Reply(content,
                                       config.Code,
                                       config.Description,
                                       config.ContentType,
                                       config.Encoding,
                                       config.Headers,
                                       ex => _logger.InfoException(ex, "Error while replying from MiniWeb"));
                }
            }
            catch (Exception ex)
            {
                http.ReplyTextContent(ex.ToString(), 500, "Internal Server Error", "text/plain", null, Console.WriteLine);
            }
        }
开发者ID:BrunoMVPCosta,项目名称:EventStore,代码行数:58,代码来源:MiniWeb.cs


示例13: OnGetOptions

 private void OnGetOptions(HttpEntityManager entity, UriTemplateMatch match)
 {
     entity.ReplyTextContent(Codec.Json.To(GetOptionsInfo(options)),
                             HttpStatusCode.OK,
                             "OK",
                             entity.ResponseCodec.ContentType,
                             null,
                             e => Log.ErrorException(e, "error while writing http response (options)"));
 }
开发者ID:BrunoMVPCosta,项目名称:EventStore,代码行数:9,代码来源:InfoController.cs


示例14: OnGetPing

 private void OnGetPing(HttpEntityManager entity, UriTemplateMatch match)
 {
     var response = new HttpMessage.TextMessage("Ping request successfully handled");
     entity.ReplyTextContent(Format.TextMessage(entity, response),
                             HttpStatusCode.OK,
                             "OK",
                             entity.ResponseCodec.ContentType,
                             null,
                             e => Log.ErrorException(e, "Error while writing HTTP response (ping)"));
 }
开发者ID:danieldeb,项目名称:EventStore,代码行数:10,代码来源:PingController.cs


示例15: OnListNodeSubsystems

 private void OnListNodeSubsystems(HttpEntityManager http, UriTemplateMatch match)
 {
     http.ReplyTextContent(
     Codec.Json.To(_enabledNodeSubsystems),
     200,
     "OK",
     "application/json",
     null,
     ex => Log.InfoException(ex, "Failed to prepare main menu")
     );
 }
开发者ID:jjvdangelo,项目名称:EventStore,代码行数:11,代码来源:WebSiteController.cs


示例16: OnGetInfo

 private void OnGetInfo(HttpEntityManager entity, UriTemplateMatch match)
 {
     entity.ReplyTextContent(Codec.Json.To(new
                             {
                                 ESVersion = VersionInfo.Version
                             }),
                             HttpStatusCode.OK,
                             "OK",
                             entity.ResponseCodec.ContentType,
                             null,
                             e => Log.ErrorException(e, "Error while writing http response (info)"));
 }
开发者ID:adbrowne,项目名称:EventStore,代码行数:12,代码来源:InfoController.cs


示例17: GetNackAction

 private static ClientMessages.NakAction GetNackAction(HttpEntityManager manager, UriTemplateMatch match, NakAction nakAction = NakAction.Unknown)
 {
     var rawValue = match.BoundVariables["action"] ?? string.Empty;
     switch (rawValue.ToLowerInvariant())
     {
         case "park": return ClientMessages.NakAction.Park;
         case "retry": return ClientMessages.NakAction.Retry;
         case "skip": return ClientMessages.NakAction.Skip;
         case "stop": return ClientMessages.NakAction.Stop;
         default: return ClientMessages.NakAction.Unknown;
     }
 }
开发者ID:EventStore,项目名称:EventStore,代码行数:12,代码来源:PersistentSubscriptionController.cs


示例18: OnPostShutdown

 private void OnPostShutdown(HttpEntityManager entity, UriTemplateMatch match)
 {
     if (entity.User != null && entity.User.IsInRole(SystemRoles.Admins))
     {
         Log.Info("Request shut down of node because shutdown command has been received.");
         Publish(new ClientMessage.RequestShutdown(exitProcess: true));
         entity.ReplyStatus(HttpStatusCode.OK, "OK", LogReplyError);
     }
     else
     {
         entity.ReplyStatus(HttpStatusCode.Unauthorized, "Unauthorized", LogReplyError);
     }
 }
开发者ID:riccardone,项目名称:EventStore,代码行数:13,代码来源:AdminController.cs


示例19: OnPostScavenge

 private void OnPostScavenge(HttpEntityManager entity, UriTemplateMatch match)
 {
     if (entity.User != null && entity.User.IsInRole(SystemRoles.Admins))
     {
         Log.Info("Request scavenging because /admin/scavenge request has been received.");
         Publish(new ClientMessage.ScavengeDatabase(new NoopEnvelope(), Guid.Empty, entity.User));
         entity.ReplyStatus(HttpStatusCode.OK, "OK", LogReplyError);
     }
     else
     {
         entity.ReplyStatus(HttpStatusCode.Unauthorized, "Unauthorized", LogReplyError);
     }
 }
开发者ID:riccardone,项目名称:EventStore,代码行数:13,代码来源:AdminController.cs


示例20: OnGetHistogram

 private void OnGetHistogram(HttpEntityManager entity, UriTemplateMatch match)
 {
     var name = match.BoundVariables["name"];
    
     var histogram = Histograms.HistogramService.GetHistogram(name);
     if (histogram == null)
     {
         entity.ReplyStatus(HttpStatusCode.NotFound, "Not found", _ => { });
         return;
     }
     var writer = new StringWriter();
     lock (histogram)
     {
         histogram.outputPercentileDistribution(writer, outputValueUnitScalingRatio: 1000.0*1000.0);
     }
     var response = Encoding.ASCII.GetBytes(writer.ToString());
     entity.Reply(response,
         HttpStatusCode.OK, 
         "OK", 
         ContentType.PlainText, 
         Encoding.ASCII, 
         null,
         _ => { });
 }
开发者ID:danieldeb,项目名称:EventStore,代码行数:24,代码来源:HistogramController.cs



注:本文中的EventStore.Transport.Http.EntityManagement.HttpEntityManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# NoteStore.NoteFilter类代码示例发布时间:2022-05-24
下一篇:
C# EntityManagement.HttpEntity类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap