Ejemplo n.º 1
0
        /// <summary>
        /// Enables processing of HTTP Web requests by a custom HttpHandler that implements
        ///     the <see cref="T:System.Web.IHttpHandler"></see> interface.
        /// </summary>
        /// <param name="context">
        /// An <see cref="T:System.Web.HttpContext"></see> object that provides references
        ///     to the intrinsic server objects (for example, Request, Response, Session, and Server) used to service HTTP requests.
        /// </param>
        public void ProcessRequest(HttpContext context)
        {
            if (!Security.IsAuthorizedTo(Rights.ViewPublicPosts))
            {
                context.Response.StatusCode = 401;
                return;
            }

            var title  = RetrieveTitle(context);
            var format = RetrieveFormat(context);
            var list   = GenerateItemList(context);

            list = CleanList(list);

            if (string.IsNullOrEmpty(context.Request.QueryString["post"]))
            {
                // Shorten the list to the number of posts stated in the settings, except for the comment feed.
                var max = Math.Min(BlogSettings.Instance.PostsPerFeed, list.Count);
                list = list.FindAll(item => item.IsVisible);

                list = list.GetRange(0, max);
            }

            SetHeaderInformation(context, list, format);

            if (BlogSettings.Instance.EnableHttpCompression)
            {
                CompressionModule.CompressResponse(context);
            }

            var generator = new SyndicationGenerator(BlogSettings.Instance, Category.Categories);

            generator.WriteFeed(format, context.Response.OutputStream, list, title);
        }
        /// <summary>
        /// Enables processing of HTTP Web requests by a custom HttpHandler that implements 
        ///     the <see cref="T:System.Web.IHttpHandler"></see> interface.
        /// </summary>
        /// <param name="context">
        /// An <see cref="T:System.Web.HttpContext"></see> object that provides references 
        ///     to the intrinsic server objects (for example, Request, Response, Session, and Server) used to service HTTP requests.
        /// </param>
        public void ProcessRequest(HttpContext context)
        {
            if (!Security.IsAuthorizedTo(Rights.ViewPublicPosts))
            {
                context.Response.StatusCode = 401;
                return;
            }

            var title = RetrieveTitle(context);
            var format = RetrieveFormat(context);
            var list = GenerateItemList(context);
            list = CleanList(list);

            if (string.IsNullOrEmpty(context.Request.QueryString["post"]))
            {
                // Shorten the list to the number of posts stated in the settings, except for the comment feed.
                var max = Math.Min(BlogSettings.Instance.PostsPerFeed, list.Count);
                list = list.FindAll(item => item.IsVisible);

                list = list.GetRange(0, max);
            }

            SetHeaderInformation(context, list, format);

            if (BlogSettings.Instance.EnableHttpCompression)
            {
                CompressionModule.CompressResponse(context);
            }

            var generator = new SyndicationGenerator(BlogSettings.Instance, Category.Categories);
            generator.WriteFeed(format, context.Response.OutputStream, list, title);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Enables processing of HTTP Web requests by a custom HttpHandler that implements
        /// the <see cref="T:System.Web.IHttpHandler"></see> interface.
        /// </summary>
        /// <param name="context">An <see cref="T:System.Web.HttpContext"></see> object that provides references
        /// to the intrinsic server objects (for example, Request, Response, Session, and Server) used to service HTTP requests.
        /// </param>
        public void ProcessRequest(HttpContext context)
        {
            string              title  = RetrieveTitle(context);
            SyndicationFormat   format = RetrieveFormat(context);
            List <IPublishable> list   = GenerateItemList(context);

            list = CleanList(list);

            if (string.IsNullOrEmpty(context.Request.QueryString["post"]))
            {
                // Shorten the list to the number of posts stated in the settings, except for the comment feed.
                int max = Math.Min(BlogSettings.Instance.PostsPerFeed, list.Count);
                list = list.FindAll(delegate(IPublishable item)
                {
                    return(item.IsVisible == true);
                });

                list = list.GetRange(0, max);
            }

            SetHeaderInformation(context, list, format);

            if (BlogSettings.Instance.EnableHttpCompression)
            {
                HttpModules.CompressionModule.CompressResponse(context);
            }

            SyndicationGenerator generator = new SyndicationGenerator(BlogSettings.Instance, Category.Categories);

            generator.WriteFeed(format, context.Response.OutputStream, list, title);
        }
        /// <summary>
        /// Enables processing of HTTP Web requests by a custom HttpHandler that implements
        ///     the <see cref="T:System.Web.IHttpHandler"></see> interface.
        /// </summary>
        /// <param name="context">
        /// An <see cref="T:System.Web.HttpContext"></see> object that provides references
        ///     to the intrinsic server objects (for example, Request, Response, Session, and Server) used to service HTTP requests.
        /// </param>
        public void ProcessRequest(HttpContext context)
        {
            if (!Security.IsAuthorizedTo(Rights.ViewPublicPosts))
            {
                context.Response.StatusCode = 401;
                return;
            }

            var title  = RetrieveTitle(context);
            var format = RetrieveFormat(context);
            var list   = GenerateItemList(context);

            list = CleanList(list);

            if (string.IsNullOrEmpty(context.Request.QueryString["post"]))
            {
                // Shorten the list to the number of posts stated in the settings, except for the comment feed.
                var max = BlogSettings.Instance.PostsPerFeed;

                // usually we want to restrict number of posts for subscribers to latest
                // but it can be overriden in query string to bring any number of items
                if (!string.IsNullOrEmpty(context.Request.QueryString["maxitems"]))
                {
                    int maxItems;
                    if (int.TryParse(context.Request.QueryString["maxitems"], out maxItems))
                    {
                        max = maxItems;
                    }
                }

                list = list.FindAll(item => item.IsVisible).Take(Math.Min(max, list.Count)).ToList();
            }

            SetHeaderInformation(context, list, format);

            if (BlogSettings.Instance.EnableHttpCompression)
            {
                CompressionModule.CompressResponse(context);
            }

            var generator = new SyndicationGenerator(BlogSettings.Instance, Category.Categories);

            generator.WriteFeed(format, context.Response.OutputStream, list, title);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Enables processing of HTTP Web requests by a custom HttpHandler that implements
        ///     the <see cref="T:System.Web.IHttpHandler"></see> interface.
        /// </summary>
        /// <param name="context">
        /// An <see cref="T:System.Web.HttpContext"></see> object that provides references
        ///     to the intrinsic server objects (for example, Request, Response, Session, and Server) used to service HTTP requests.
        /// </param>
        public void ProcessRequest(HttpContext context)
        {
            var title  = RetrieveTitle(context);
            var format = RetrieveFormat(context);
            var list   = GenerateItemList(context);

            list = CleanList(list);

            // Sueetie Modified - Enter Rss Retrieval
            BlogCommon.FireAndForgetRecordBlogRss(new
                                                  SueetieBlogRss
            {
                ApplicationID = SueetieApplications.Current.ApplicationID,
                RemoteIP      = context.Request.UserHostAddress,
                UserAgent     = context.Request.UserAgent
            });

            if (string.IsNullOrEmpty(context.Request.QueryString["post"]))
            {
                // Shorten the list to the number of posts stated in the settings, except for the comment feed.
                var max = Math.Min(BlogSettings.Instance.PostsPerFeed, list.Count);
                list = list.FindAll(item => item.IsVisible);

                list = list.GetRange(0, max);
            }

            SetHeaderInformation(context, list, format);

            if (BlogSettings.Instance.EnableHttpCompression)
            {
                CompressionModule.CompressResponse(context);
            }

            var generator = new SyndicationGenerator(BlogSettings.Instance, Category.Categories);

            generator.WriteFeed(format, context.Response.OutputStream, list, title);
        }
        /// <summary>
        /// Enables processing of HTTP Web requests by a custom HttpHandler that implements 
        ///     the <see cref="T:System.Web.IHttpHandler"></see> interface.
        /// </summary>
        /// <param name="context">
        /// An <see cref="T:System.Web.HttpContext"></see> object that provides references 
        ///     to the intrinsic server objects (for example, Request, Response, Session, and Server) used to service HTTP requests.
        /// </param>
        public void ProcessRequest(HttpContext context)
        {
            if (!Security.IsAuthorizedTo(Rights.ViewPublicPosts))
            {
                context.Response.StatusCode = 401;
                return;
            }

            var title = RetrieveTitle(context);
            var format = RetrieveFormat(context);
            var list = GenerateItemList(context);
            list = CleanList(list);

            if (string.IsNullOrEmpty(context.Request.QueryString["post"]))
            {
                // Shorten the list to the number of posts stated in the settings, except for the comment feed.
                var max = BlogSettings.Instance.PostsPerFeed;
                
                // usually we want to restrict number of posts for subscribers to latest
                // but it can be overriden in query string to bring any number of items
                if (!string.IsNullOrEmpty(context.Request.QueryString["maxitems"]))
                {
                    int maxItems;
                    if (int.TryParse(context.Request.QueryString["maxitems"], out maxItems))
                        max = maxItems;
                }

                list = list.FindAll(item => item.IsVisible).Take(Math.Min(max, list.Count)).ToList();
            }

            SetHeaderInformation(context, list, format);

            if (BlogSettings.Instance.EnableHttpCompression)
            {
                CompressionModule.CompressResponse(context);
            }

            var generator = new SyndicationGenerator(BlogSettings.Instance, Category.Categories);
            generator.WriteFeed(format, context.Response.OutputStream, list, title);
        }