Ejemplo n.º 1
0
        /// <summary>
        /// 派生类重写此方法接管 HTTP 请求处理流程
        /// </summary>
        /// <param name="context">当前 HTML 请求上下文</param>
        /// <param name="handler">用于处理 HTML 文档的处理程序</param>
        /// <returns>处理后的结果</returns>
        protected virtual ICachedResponse ProcessRequest(HtmlRequestContext context, IHtmlHandler handler)
        {
            var filters = GetFilters(context.VirtualPath);



            OnProcessing(context, filters);

            Trace("Begin process document.");
            handler.ProcessScope(context);
            Trace("End process document.");

            OnProcessed(context, filters);



            OnRendering(context, filters);

            Trace("Begin render document.");
            string content;

            using (StringWriter writer = new StringWriter())
            {
                context.Scope.RenderChilds(writer, GetAdapters(handler));
                content = writer.ToString();
            }

            Trace("End render document.");

            OnRendered(context, filters);

            return(CreateResponse(content));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 重写 ProcessScope 方法,重定向到被包装的 Handler
 /// </summary>
 protected override void ProcessScope()
 {
     _handler.ProcessScope(new HtmlRequestContext(HttpContext, VirtualPath, Scope));
 }
Ejemplo n.º 3
0
    /// <summary>
    /// 派生类重写此方法接管 HTTP 请求处理流程
    /// </summary>
    /// <param name="context">当前 HTML 请求上下文</param>
    /// <param name="handler">用于处理 HTML 文档的处理程序</param>
    /// <returns>处理后的结果</returns>
    protected virtual ICachedResponse ProcessRequest( HtmlRequestContext context, IHtmlHandler handler )
    {

      var filters = GetFilters( context.VirtualPath );



      OnProcessing( context, filters );

      Trace( "Begin process document." );
      handler.ProcessScope( context );
      Trace( "End process document." );

      OnProcessed( context, filters );




      OnRendering( context, filters );

      Trace( "Begin render document." );
      string content;
      using ( StringWriter writer = new StringWriter() )
      {
        context.Scope.RenderChilds( writer, GetAdapters( handler ) );
        content = writer.ToString();
      }

      Trace( "End render document." );

      OnRendered( context, filters );

      return CreateResponse( content );
    }