Beispiel #1
0
        internal void InitValidateInternal()
        {
            string verb = Verb;

            // Remove all spaces from verbs before wildcard parsing.
            //   - We don't want get in "POST, GET" to be parsed into " GET".
            verb = verb.Replace(" ", String.Empty);     // replace all " " with String.Empty in requestType

            _requestType = new Wildcard(verb, false);   // case-sensitive wildcard
            _path        = new WildcardUrl(Path, true); // case-insensitive URL wildcard

            // if validate="false" is marked on a handler, then the type isn't created until a request
            // is actually made that requires the handler. This (1) allows us to list handlers that
            // aren't present without throwing errors at init time and (2) speeds up init by avoiding
            // loading types until they are needed.

            if (!Validate)
            {
                _type = null;
            }
            else
            {
                _type = ConfigUtil.GetType(Type, "type", this);

                if (!ConfigUtil.IsTypeHandlerOrFactory(_type))
                {
                    throw new ConfigurationErrorsException(
                              SR.GetString(SR.Type_not_factory_or_handler, Type),
                              ElementInformation.Source, ElementInformation.LineNumber);
                }
            }
        }
Beispiel #2
0
        internal Type GetHandlerType(HttpHandlerAction handlerAction)
        {
            Type typeWithAssert = this.GetTypeWithAssert(handlerAction.Type);

            if (!ConfigUtil.IsTypeHandlerOrFactory(typeWithAssert))
            {
                throw new ConfigurationErrorsException(System.Web.SR.GetString("Type_not_factory_or_handler", new object[] { handlerAction.Type }), handlerAction.ElementInformation.Source, handlerAction.ElementInformation.LineNumber);
            }
            return(typeWithAssert);
        }
Beispiel #3
0
        internal Type GetHandlerType(string type)
        {
            Type typeWithAssert = this.GetTypeWithAssert(type);

            HttpRuntime.FailIfNoAPTCABit(typeWithAssert, null, null);
            if (!ConfigUtil.IsTypeHandlerOrFactory(typeWithAssert))
            {
                throw new ConfigurationErrorsException(System.Web.SR.GetString("Type_not_factory_or_handler", new object[] { type }));
            }
            return(typeWithAssert);
        }
 internal object Create()
 {
     if (this._type == null)
     {
         System.Type t = ConfigUtil.GetType(this.Type, "type", this);
         if (!ConfigUtil.IsTypeHandlerOrFactory(t))
         {
             throw new ConfigurationErrorsException(System.Web.SR.GetString("Type_not_factory_or_handler", new object[] { this.Type }), base.ElementInformation.Source, base.ElementInformation.LineNumber);
         }
         this._type = t;
     }
     return(HttpRuntime.CreateNonPublicInstance(this._type));
 }
Beispiel #5
0
        internal Type GetHandlerType(HttpHandlerAction handlerAction)
        {
            // HACKHACK: for now, let uncreatable types through and error later (for .soap factory)
            // This design should change - developers will want to know immediately
            // when they misspell a type

            Type t = GetTypeWithAssert(handlerAction.Type);

            // throw for bad types in deferred case
            if (!ConfigUtil.IsTypeHandlerOrFactory(t))
            {
                throw new ConfigurationErrorsException(SR.GetString(SR.Type_not_factory_or_handler, handlerAction.Type),
                                                       handlerAction.ElementInformation.Source, handlerAction.ElementInformation.LineNumber);
            }

            return(t);
        }
Beispiel #6
0
        internal Type GetHandlerType(string type)
        {
            // HACKHACK: for now, let uncreatable types through and error later (for .soap factory)
            // This design should change - developers will want to know immediately
            // when they misspell a type

            Type t = GetTypeWithAssert(type);

            HttpRuntime.FailIfNoAPTCABit(t, null, null);

            // throw for bad types in deferred case
            if (!ConfigUtil.IsTypeHandlerOrFactory(t))
            {
                throw new ConfigurationErrorsException(SR.GetString(SR.Type_not_factory_or_handler, type));
            }

            return(t);
        }
        internal void InitValidateInternal()
        {
            string pattern = this.Verb.Replace(" ", string.Empty);

            this._requestType = new Wildcard(pattern, false);
            this._path        = new WildcardUrl(this.Path, true);
            if (!this.Validate)
            {
                this._type = null;
            }
            else
            {
                this._type = ConfigUtil.GetType(this.Type, "type", this);
                if (!ConfigUtil.IsTypeHandlerOrFactory(this._type))
                {
                    throw new ConfigurationErrorsException(System.Web.SR.GetString("Type_not_factory_or_handler", new object[] { this.Type }), base.ElementInformation.Source, base.ElementInformation.LineNumber);
                }
            }
        }
Beispiel #8
0
        internal Object Create()
        {
            // HACKHACK: for now, let uncreatable types through and error later (for .soap factory)
            // This design should change - developers will want to know immediately
            // when they misspell a type

            if (_type == null)
            {
                Type t = ConfigUtil.GetType(Type, "type", this);

                // throw for bad types in deferred case
                if (!ConfigUtil.IsTypeHandlerOrFactory(t))
                {
                    throw new ConfigurationErrorsException(
                              SR.GetString(SR.Type_not_factory_or_handler, Type),
                              ElementInformation.Source, ElementInformation.LineNumber);
                }

                _type = t;
            }

            return(HttpRuntime.CreateNonPublicInstanceByWebObjectActivator(_type));
        }