public override void Process( ProcessContext context ) { MvcEventPublisher.Instance.BeginCheckPermission( context.ctx ); if (context.ctx.utils.isSkipCurrentProcessor()) return; MvcContext ctx = context.ctx; IList paths = ctx.utils.getLayoutPath(); for (int i = paths.Count - 1; i >= 0; i--) { ControllerBase controller = ControllerFactory.FindSecurityController( paths[i].ToString(), ctx ); if (controller == null) continue; if (ctx.controller.utils.isCheckPermission( controller.GetType() )) { controller.CheckPermission(); } if (ctx.utils.isEnd()) { String msg = controller.utils.getActionResult(); context.endMsgByText( checkFrame( ctx, msg ) ); return; } } context.getController().CheckPermission(); if (ctx.utils.isEnd()) { context.endMsgByText( checkFrame( ctx, context.getController().utils.getActionResult() ) ); return; } }
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.BeginCheckPermission(context.ctx); if (context.ctx.utils.isSkipCurrentProcessor()) { return; } MvcContext ctx = context.ctx; IList paths = ctx.utils.getLayoutPath(); for (int i = paths.Count - 1; i >= 0; i--) { ControllerBase controller = ControllerFactory.FindSecurityController(paths[i].ToString(), ctx); if (controller == null) { continue; } if (ctx.controller.utils.isCheckPermission(controller.GetType())) { controller.CheckPermission(); } if (ctx.utils.isEnd()) { String msg = controller.utils.getActionResult(); context.endMsgByText(checkFrame(ctx, msg)); return; } } context.getController().CheckPermission(); if (ctx.utils.isEnd()) { context.endMsgByText(checkFrame(ctx, context.getController().utils.getActionResult())); return; } }
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 ) ); } }
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)); } }