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


C# IHttpRequest.GetAttributes方法代码示例

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


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

示例1: GetResponse

		public override object GetResponse(IHttpRequest httpReq, IHttpResponse httpRes, object request)
		{
			var response = ExecuteService(request,
                HandlerAttributes | httpReq.GetAttributes(), httpReq, httpRes);
			
			return response;
		}
开发者ID:ELHANAFI,项目名称:ServiceStack,代码行数:7,代码来源:GenericHandler.cs

示例2: AssertAccess

        protected bool AssertAccess(IHttpRequest httpReq, IHttpResponse httpRes, string operationName)
        {
            if (!EndpointHost.Config.HasFeature(Feature.Metadata))
            {
                EndpointHost.Config.HandleErrorResponse(httpReq, httpRes, HttpStatusCode.Forbidden, "Metadata Not Available");
                return false;
            }

            if (EndpointHost.Config.MetadataVisibility != EndpointAttributes.Any)
            {
                var actualAttributes = httpReq.GetAttributes();
                if ((actualAttributes & EndpointHost.Config.MetadataVisibility) != EndpointHost.Config.MetadataVisibility)
                {
                    EndpointHost.Config.HandleErrorResponse(httpReq, httpRes, HttpStatusCode.Forbidden, "Metadata Not Visible");
                    return false;
                }
            }

            if (operationName == null) return true; //For non-operation pages we don't need to check further permissions
            if (!EndpointHost.Config.EnableAccessRestrictions) return true;
            if (!EndpointHost.Config.MetadataPagesConfig.IsVisible(httpReq, Format, operationName))
            {
                EndpointHost.Config.HandleErrorResponse(httpReq, httpRes, HttpStatusCode.Forbidden, "Service Not Available");
                return false;
            }

            return true;
        }
开发者ID:mikkelfish,项目名称:ServiceStack,代码行数:28,代码来源:BaseMetadataHandler.cs

示例3: ProcessRequest

        public override void ProcessRequest(IHttpRequest httpReq, IHttpResponse httpRes, string operationName)
        {
            var isDebugRequest = httpReq.RawUrl.ToLower().Contains("debug");
            if (!isDebugRequest)
            {
                base.ProcessRequest(httpReq, httpRes, operationName);
                return;
            }

            try
            {
                var request = CreateRequest(httpReq, operationName);

                var response = ExecuteService(request,
                    HandlerAttributes | httpReq.GetAttributes(), httpReq, httpRes);

                WriteDebugResponse(httpRes, response);
            }
            catch (Exception ex)
            {
                if (!EndpointHost.Config.WriteErrorsToResponse) throw;
                HandleException(httpReq, httpRes, operationName, ex);
            }
        }
开发者ID:robertgreen,项目名称:ServiceStack,代码行数:24,代码来源:JsvSyncReplyHandler.cs

示例4: CanAccess

 public bool CanAccess(IHttpRequest httpReq, Format format, string operationName)
 {
     var reqAttrs = httpReq.GetAttributes();
     return CanAccess(reqAttrs, format, operationName);
 }
开发者ID:yeurch,项目名称:ServiceStack,代码行数:5,代码来源:ServiceMetadata.cs

示例5: IsVisible

        public bool IsVisible(IHttpRequest httpReq, Operation operation)
        {
            if (EndpointHost.Config != null && !EndpointHost.Config.EnableAccessRestrictions)
                return true;

            if (operation.RestrictTo == null) return true;

            //Less fine-grained on /metadata pages. Only check Network and Format
            var reqAttrs = httpReq.GetAttributes();
            var showToNetwork = CanShowToNetwork(operation, reqAttrs);
            return showToNetwork;
        }
开发者ID:yeurch,项目名称:ServiceStack,代码行数:12,代码来源:ServiceMetadata.cs

示例6: HasAccessToMetadata

        public bool HasAccessToMetadata(IHttpRequest httpReq, IHttpResponse httpRes)
        {
            if (!HasFeature(Feature.Metadata))
            {
                EndpointHost.Config.HandleErrorResponse(httpReq, httpRes, HttpStatusCode.Forbidden, "Metadata Not Available");
                return false;
            }

            if (MetadataVisibility != EndpointAttributes.Any)
            {
                var actualAttributes = httpReq.GetAttributes();
                if ((actualAttributes & MetadataVisibility) != MetadataVisibility)
                {
                    HandleErrorResponse(httpReq, httpRes, HttpStatusCode.Forbidden, "Metadata Not Visible");
                    return false;
                }
            }
            return true;
        }
开发者ID:pruiz,项目名称:ServiceStack,代码行数:19,代码来源:EndpointHostConfig.cs

示例7: GetResponse

        public override object GetResponse(IHttpRequest httpReq, IHttpResponse httpRes, object request)
        {
            var requestContentType = ContentType.GetEndpointAttributes(httpReq.ResponseContentType);

            return ExecuteService(request,
                HandlerAttributes | requestContentType | httpReq.GetAttributes(), httpReq, httpRes);
        }
开发者ID:jmaucher,项目名称:SStack,代码行数:7,代码来源:RestHandler.cs

示例8: IsVisible

        public bool IsVisible(IHttpRequest httpReq, Format format, string operationName)
        {
            Operation operation;
            OperationNamesMap.TryGetValue(operationName.ToLower(), out operation);
            if (operation == null) return false;

            var reqAttrs = httpReq.GetAttributes();

            var canCall = HasImplementation(operation, format);
            if (!canCall) return false;

            if (operation.RestrictTo == null) return true;

            var visbleToNetwork = CanShowToNetwork(operation, reqAttrs);
            if (!visbleToNetwork) return false;

            var allowsFormat = operation.RestrictTo.CanShowTo((EndpointAttributes)(long)format);
            return allowsFormat;
        }
开发者ID:namman,项目名称:ServiceStack,代码行数:19,代码来源:ServiceMetadata.cs

示例9: IsVisible

        public bool IsVisible(IHttpRequest httpReq, Format format, string operationName)
        {
            if (EndpointHost.Config != null && !EndpointHost.Config.EnableAccessRestrictions)
                return true;

            Operation operation;
            OperationNamesMap.TryGetValue(operationName.ToLower(), out operation);
            if (operation == null) return false;

            var canCall = HasImplementation(operation, format);
            if (!canCall) return false;

            if (operation.RestrictTo == null) return true;

            //Less fine-grained on /metadata pages. Only check Network and Format
            var reqAttrs = httpReq.GetAttributes();
            var showToNetwork = CanShowToNetwork(operation, reqAttrs);
            if (!showToNetwork) return false;

            var allowsFormat = operation.RestrictTo.CanShowTo((EndpointAttributes)(long)format);
            return allowsFormat;
        }
开发者ID:donfeel,项目名称:ServiceStack,代码行数:22,代码来源:ServiceMetadata.cs


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