public override void Process(ProcessContext context) { MvcContext ctx = context.ctx; // page meta String pageContent = context.getContent(); pageContent = processPageMeta(pageContent, ctx); context.setContent(pageContent); // page cache if (MvcConfig.Instance.IsPageCache) { addPageCache(context, ctx); } MvcEventPublisher.Instance.BeginRender(ctx); if (context.ctx.utils.isSkipCurrentProcessor()) { return; } ctx.utils.clearResource(); ctx.web.ResponseWrite(context.getContent()); MvcEventPublisher.Instance.EndRender(ctx); }
public override void Process( ProcessContext context ) { MvcEventPublisher.Instance.BeginAddNsLayout( context.ctx ); if (context.ctx.utils.isSkipCurrentProcessor()) return; MvcContext ctx = context.ctx; String content = context.getContent(); int intNoLayout = ctx.utils.getNoLayout(); if (intNoLayout < 0) intNoLayout = 0; IList paths = ctx.utils.getLayoutPath(); int pathCount = paths.Count - intNoLayout; for (int i = 0; i < pathCount; i++) { Boolean isLastLayout = i == pathCount - 1; content = addLayoutPrivate( paths[i].ToString(), content, ctx, isLastLayout ); if (ctx.utils.isEnd()) return; } if (intNoLayout > 0) { if (ctx.utils.isFrame()) { content = MvcUtil.getFrameContent( content ); } else { content = MvcUtil.getNoLayoutContent( content ); } } context.setContent( content ); }
private static void addPageCache(ProcessContext context, MvcContext ctx) { if (ctx.controller == null) { return; } if (ctx.IsMock) { return; } IPageCache pageCache = ControllerMeta.GetPageCache(ctx.controller.GetType(), ctx.route.action); if (pageCache == null) { return; } if (pageCache.IsCache(ctx) == false) { return; } String key = ctx.url.PathAndQuery; if (MvcConfig.Instance.CheckDomainMap()) { key = ctx.url.ToString(); } CacheManager.GetApplicationCache().Put(key, context.getContent()); logger.Info("add page cache, key=" + key); pageCache.AfterCachePage(ctx); }
public override void Process( ProcessContext context ) { MvcEventPublisher.Instance.BeginAddLayout( context.ctx ); if (context.ctx.utils.isSkipCurrentProcessor()) return; MvcContext ctx = context.ctx; ControllerBase controller = context.getController(); if (controller.utils.isHided( controller.GetType() )) { return; } int intNoLayout = ctx.utils.getNoLayout(); IList paths = ctx.utils.getLayoutPath(); if (intNoLayout >= paths.Count + 1) return; String actionContent = context.getContent(); //检查缓存 String cacheKey = null; if (MvcConfig.Instance.IsActionCache) { IActionCache actionCache = ControllerMeta.GetActionCache( controller.GetType(), "Layout" ); cacheKey = getCacheKey( actionCache, ctx ); if (strUtil.HasText( cacheKey )) { Object cacheContent = checkCache( cacheKey ); if (cacheContent != null) { logger.Info( "load from layoutCache=" + cacheKey ); context.setContent( HtmlCombiner.combinePage( cacheContent.ToString(), actionContent ) ); return; } } } String layoutContent; if (controller.LayoutControllerType == null) { layoutContent = runCurrentLayout( controller, ctx, context, actionContent ); } else { layoutContent = runOtherLayout( controller, ctx, context, actionContent ); } // 加入缓存 if (MvcConfig.Instance.IsActionCache) { if (strUtil.HasText( cacheKey )) { addContentToCache( cacheKey, layoutContent ); } } if (ctx.utils.isEnd()) { context.endMsgByText( layoutContent ); } else { context.setContent( HtmlCombiner.combinePage( layoutContent, actionContent ) ); } }
public override void Process(ProcessContext context) { MvcEventPublisher.Instance.BeginAddLayout(context.ctx); if (context.ctx.utils.isSkipCurrentProcessor()) { return; } MvcContext ctx = context.ctx; ControllerBase controller = context.getController(); if (controller.utils.isHided(controller.GetType())) { return; } int intNoLayout = ctx.utils.getNoLayout(); IList paths = ctx.utils.getLayoutPath(); if (intNoLayout >= paths.Count + 1) { return; } String actionContent = context.getContent(); //检查缓存 CacheInfo ci = CacheInfo.InitLayout(ctx); Object cacheContent = ci.CheckCache(); if (cacheContent != null) { logger.Info("load from layoutCache=" + ci.CacheKey); context.setContent(HtmlCombiner.combinePage(cacheContent.ToString(), actionContent)); return; } String layoutContent = ControllerRunner.RunLayout(ctx); // 加入缓存 if (ci.IsActionCache) { ci.AddContentToCache(layoutContent); } if (ctx.utils.isEnd()) { context.endMsgByText(layoutContent); } else { context.setContent(HtmlCombiner.combinePage(layoutContent, actionContent)); } }
public override void Process( ProcessContext context ) { MvcContext ctx = context.ctx; // page meta String pageContent = context.getContent(); pageContent = processPageMeta( pageContent, ctx ); context.setContent( pageContent ); // page cache if (MvcConfig.Instance.IsPageCache) { addPageCache( context, ctx ); } MvcEventPublisher.Instance.BeginRender( ctx ); if (context.ctx.utils.isSkipCurrentProcessor()) return; ctx.utils.clearResource(); ctx.web.ResponseWrite( context.getContent() ); MvcEventPublisher.Instance.EndRender( ctx ); }
public override void Process(ProcessContext context) { MvcEventPublisher.Instance.BeginAddNsLayout(context.ctx); if (context.ctx.utils.isSkipCurrentProcessor()) { return; } MvcContext ctx = context.ctx; String content = context.getContent(); int intNoLayout = ctx.utils.getNoLayout(); if (intNoLayout < 0) { intNoLayout = 0; } IList paths = ctx.utils.getLayoutPath(); int pathCount = paths.Count - intNoLayout; for (int i = 0; i < pathCount; i++) { Boolean isLastLayout = i == pathCount - 1; content = addLayoutPrivate(paths[i].ToString(), content, ctx, isLastLayout); if (ctx.utils.isEnd()) { context.endMsgByView(content); return; } } if (intNoLayout > 0) { if (ctx.utils.isFrame()) { content = MvcUtil.getFrameContent(content); } else { content = MvcUtil.getNoLayoutContent(content); } } context.setContent(content); }
private static void addPageCache( ProcessContext context, MvcContext ctx ) { if (ctx.controller == null) return; if (ctx.IsMock) return; IPageCache pageCache = ControllerMeta.GetPageCache( ctx.controller.GetType(), ctx.route.action ); if (pageCache == null) return; if (pageCache.IsCache( ctx ) == false) return; String key = ctx.url.PathAndQuery; if (MvcConfig.Instance.CheckDomainMap()) key = ctx.url.ToString(); CacheManager.GetApplicationCache().Put( key, context.getContent() ); logger.Info( "add page cache, key=" + key ); pageCache.AfterCachePage( ctx ); }
public override void Process( ProcessContext context ) { MvcEventPublisher.Instance.BeginAddLayout( context.ctx ); if (context.ctx.utils.isSkipCurrentProcessor()) return; MvcContext ctx = context.ctx; ControllerBase controller = context.getController(); if (controller.utils.isHided( controller.GetType() )) { return; } int intNoLayout = ctx.utils.getNoLayout(); IList paths = ctx.utils.getLayoutPath(); if (intNoLayout >= paths.Count + 1) return; String actionContent = context.getContent(); //检查缓存 CacheInfo ci = CacheInfo.InitLayout( ctx ); Object cacheContent = ci.CheckCache(); if (cacheContent != null) { logger.Info( "load from layoutCache=" + ci.CacheKey ); context.setContent( HtmlCombiner.combinePage( cacheContent.ToString(), actionContent ) ); return; } String layoutContent = ControllerRunner.RunLayout( ctx ); // 加入缓存 if (ci.IsActionCache) { ci.AddContentToCache( layoutContent ); } if (ctx.utils.isEnd()) { context.endMsgByText( layoutContent ); } else { context.setContent( HtmlCombiner.combinePage( layoutContent, actionContent ) ); } }
public override void Process(ProcessContext context) { MvcEventPublisher.Instance.BeginAddLayout(context.ctx); if (context.ctx.utils.isSkipCurrentProcessor()) { return; } MvcContext ctx = context.ctx; ControllerBase controller = context.getController(); if (controller.utils.isHided(controller.GetType())) { return; } int intNoLayout = ctx.utils.getNoLayout(); IList paths = ctx.utils.getLayoutPath(); if (intNoLayout >= paths.Count + 1) { return; } String actionContent = context.getContent(); //检查缓存 String cacheKey = null; if (MvcConfig.Instance.IsActionCache) { IActionCache actionCache = ControllerMeta.GetActionCache(controller.GetType(), "Layout"); cacheKey = getCacheKey(actionCache, ctx); if (strUtil.HasText(cacheKey)) { Object cacheContent = checkCache(cacheKey); if (cacheContent != null) { logger.Info("load from layoutCache=" + cacheKey); context.setContent(HtmlCombiner.combinePage(cacheContent.ToString(), actionContent)); return; } } } String layoutContent; if (controller.LayoutControllerType == null) { layoutContent = runCurrentLayout(controller, ctx, context, actionContent); } else { layoutContent = runOtherLayout(controller, ctx, context, actionContent); } // 加入缓存 if (MvcConfig.Instance.IsActionCache) { if (strUtil.HasText(cacheKey)) { addContentToCache(cacheKey, layoutContent); } } if (ctx.utils.isEnd()) { context.endMsgByText(layoutContent); } else { context.setContent(HtmlCombiner.combinePage(layoutContent, actionContent)); } }