Exemplo n.º 1
0
        /// <summary>
        /// Gets the
        /// <see cref="CookieSpec">cookie specification</see>
        /// with the given ID.
        /// </summary>
        /// <param name="name">
        /// the
        /// <see cref="CookieSpec">cookie specification</see>
        /// identifier
        /// </param>
        /// <param name="params">
        /// the
        /// <see cref="Apache.Http.Params.HttpParams">HTTP parameters</see>
        /// for the cookie
        /// specification.
        /// </param>
        /// <returns>
        ///
        /// <see cref="CookieSpec">cookie specification</see>
        /// </returns>
        /// <exception cref="System.InvalidOperationException">if a policy with the given name cannot be found
        ///     </exception>
        public CookieSpec GetCookieSpec(string name, HttpParams @params)
        {
            Args.NotNull(name, "Name");
            CookieSpecFactory factory = registeredSpecs.Get(name.ToLower(Sharpen.Extensions.GetEnglishCulture()
                                                                         ));

            if (factory != null)
            {
                return(factory.NewInstance(@params));
            }
            else
            {
                throw new InvalidOperationException("Unsupported cookie spec: " + name);
            }
        }