当前位置: 首页>>代码示例>>C#>>正文


C# HttpEntityManager.ReplyStatus方法代码示例

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


在下文中一共展示了HttpEntityManager.ReplyStatus方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: SendOk

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

示例9: NackMessage

 private void NackMessage(HttpEntityManager http, UriTemplateMatch match)
 {
     var envelope = new NoopEnvelope();
     var groupname = match.BoundVariables["subscription"];
     var stream = match.BoundVariables["stream"];
     var messageId = match.BoundVariables["messageId"];
     var nakAction = GetNackAction(http, match);
     var id = Guid.NewGuid();
     if (!Guid.TryParse(messageId, out id))
     {
         http.ReplyStatus(HttpStatusCode.BadRequest, "messageid should be a properly formed guid", exception => { });
         return;
     }
     var cmd = new ClientMessage.PersistentSubscriptionNackEvents(
                                      Guid.NewGuid(),
                                      Guid.NewGuid(),
                                      envelope,
                                      BuildSubscriptionGroupKey(stream, groupname),
                                      "Nacked from HTTP",
                                      nakAction,
                                      new[] { id },
                                      http.User);
     Publish(cmd);
     http.ReplyStatus(HttpStatusCode.Accepted, "", exception => { });
 }
开发者ID:EventStore,项目名称:EventStore,代码行数:25,代码来源:PersistentSubscriptionController.cs

示例10: OnPostScavenge

 private void OnPostScavenge(HttpEntityManager entity, UriTemplateMatch match)
 {
     Log.Info("Request scavenging because /admin/scavenge request has been received.");
     Publish(new SystemMessage.ScavengeDatabase());
     entity.ReplyStatus(HttpStatusCode.OK, "OK", e => Log.ErrorException(e, "Error while closing http connection (admin controller)"));
 }
开发者ID:jjvdangelo,项目名称:EventStore,代码行数:6,代码来源:AdminController.cs

示例11: OnPostShutdown

 private void OnPostShutdown(HttpEntityManager entity, UriTemplateMatch match)
 {
     Log.Info("Request shut down of node because shutdown command has been received.");
     Publish(new ClientMessage.RequestShutdown(exitProcess: true));
     entity.ReplyStatus(HttpStatusCode.OK, "OK", e => Log.ErrorException(e, "Error while closing http connection (admin controller)"));
 }
开发者ID:jjvdangelo,项目名称:EventStore,代码行数:6,代码来源:AdminController.cs


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