Exemplo n.º 1
0
        private RestHandler(HttpContext context, Type type, string filePath)
        {
            LogicalTypeInfo logicalTypeInfo = LogicalTypeInfo.GetLogicalTypeInfo(type, filePath);
            HttpRequest     request         = context.Request;
            string          methodName      = request.PathInfo.Substring(1);

            if (logicalTypeInfo == null || String.IsNullOrEmpty(methodName))
            {
                ThrowInvalidOperationException(methodName);
            }

            _logicalMethodInfo = logicalTypeInfo [methodName];
            if (_logicalMethodInfo == null)
            {
                ThrowInvalidOperationException(methodName);
            }
        }
        public static IHttpHandler GetHandler(HttpContext context, Type type, string filePath)
        {
            RestHandler handler = new RestHandler(context, type, filePath);

            LogicalTypeInfo.LogicalMethodInfo mi = handler._logicalMethodInfo;
            if (mi.MethodInfo.IsStatic)
            {
                if (IRequiresSessionStateType.IsAssignableFrom(type))
                {
                    return(IReadOnlySessionStateType.IsAssignableFrom(type) ?
                           new ReadOnlySessionWrapperHandler(handler) : new SessionWrapperHandler(handler));
                }
            }
            else if (mi.EnableSession)
            {
                return(new SessionWrapperHandler(handler));
            }

            return(handler);
        }
Exemplo n.º 3
0
		private RestHandler (HttpContext context, Type type, string filePath) {
			LogicalTypeInfo logicalTypeInfo = LogicalTypeInfo.GetLogicalTypeInfo (type, filePath);
			HttpRequest request = context.Request;
			string methodName = request.PathInfo.Substring (1);
			if (logicalTypeInfo == null || String.IsNullOrEmpty(methodName))
				ThrowInvalidOperationException (methodName);

			_logicalMethodInfo = logicalTypeInfo [methodName];
			if (_logicalMethodInfo == null)
				ThrowInvalidOperationException (methodName);
		}