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(); //检查缓存 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 ) { MvcEventPublisher.Instance.BeginCheckForbiddenAction( context.ctx ); if (context.ctx.utils.isSkipCurrentProcessor()) return; MethodInfo actionMethod = context.ctx.ActionMethodInfo; // context.getActionMethod(); Attribute forbiddenAttr = context.getController().utils.getAttribute( actionMethod, typeof( NonVisitAttribute ) ); if (forbiddenAttr != null) { context.endMsg( lang.get( "exVisitForbidden" ), HttpStatus.Forbidden_403 ); } }
public override void Process( ProcessContext context ) { MvcEventPublisher.Instance.BeginCheckHttpMethod( context.ctx ); if (context.ctx.utils.isSkipCurrentProcessor()) return; MethodInfo actionMethod = context.ctx.ActionMethodInfo; // context.getActionMethod(); String httpMethod = context.ctx.HttpMethod; Boolean isMethodError = isHttpMethodError( context.getController().utils.getHttpMethodAttributes( actionMethod ), httpMethod ); if (isMethodError) { context.endMsg( lang.get( "exHttpMethodError" ), HttpStatus.MethodNotAllowed_405 ); } }
public override void Process( ProcessContext context ) { MvcEventPublisher.Instance.BeginCheckLoginAction( context.ctx ); if (context.ctx.utils.isSkipCurrentProcessor()) return; MethodInfo actionMethod = context.ctx.ActionMethodInfo; // context.getActionMethod(); Attribute loginAttr = context.getController().utils.getAttribute( actionMethod, typeof( LoginAttribute ) ); if (loginAttr != null && context.IsUserLogin() == false) { context.ctx.controller.redirectLogin(); } }
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.BeginCheckLoginAction(context.ctx); if (context.ctx.utils.isSkipCurrentProcessor()) { return; } MethodInfo actionMethod = context.ctx.ActionMethodInfo; // context.getActionMethod(); Attribute loginAttr = context.getController().utils.getAttribute(actionMethod, typeof(LoginAttribute)); if (loginAttr != null && context.IsUserLogin() == false) { context.ctx.controller.redirectLogin(); } }
public override void Process(ProcessContext context) { MvcEventPublisher.Instance.BeginCheckHttpMethod(context.ctx); if (context.ctx.utils.isSkipCurrentProcessor()) { return; } MethodInfo actionMethod = context.ctx.ActionMethodInfo; // context.getActionMethod(); String httpMethod = context.ctx.HttpMethod; Boolean isMethodError = isHttpMethodError(context.getController().utils.getHttpMethodAttributes(actionMethod), httpMethod); if (isMethodError) { context.endMsg(lang.get("exHttpMethodError"), HttpStatus.MethodNotAllowed_405); } }
public override void Process(ProcessContext context) { MvcEventPublisher.Instance.BeginCheckForbiddenAction(context.ctx); if (context.ctx.utils.isSkipCurrentProcessor()) { return; } MethodInfo actionMethod = context.ctx.ActionMethodInfo; // context.getActionMethod(); Attribute forbiddenAttr = context.getController().utils.getAttribute(actionMethod, typeof(NonVisitAttribute)); if (forbiddenAttr != null) { context.endMsg(lang.get("exVisitForbidden"), HttpStatus.Forbidden_403); } }
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.BeginProcessAction(context.ctx); if (context.ctx.utils.isSkipCurrentProcessor()) { return; } MvcContext ctx = context.ctx; ControllerBase controller = context.getController(); // 检查缓存 CacheInfo ci = CacheInfo.Init(ctx); Object cacheContent = ci.CheckCache(); if (cacheContent != null) { logger.Info("load from actionCache=" + ci.CacheKey); context.setContent(cacheContent.ToString()); getPageMetaFromCache(ctx, ci.CacheKey); return; } MethodInfo actionMethod = ctx.ActionMethodInfo; // context.getActionMethod(); // 设值模板并载入全局变量 setControllerView(controller, actionMethod); // 运行并处理post值 ActionRunner.runAction(ctx, controller, actionMethod, controller.utils.runAction); String actionContent = controller.utils.getActionResult(); // 加入缓存 if (ci.IsActionCache) { ci.AddContentToCache(actionContent); // 加入PageMeta addPageMetaToCache(ctx, ci.CacheKey); } actionContent = PostValueProcessor.ProcessPostValue(actionContent, ctx); if (ctx.utils.isAjax) { context.showEnd(actionContent); } else if (ctx.utils.isFrame()) { int intNoLayout = ctx.utils.getNoLayout(); if (intNoLayout == 0) { String content = MvcUtil.getFrameContent(actionContent); context.showEnd(content); } else { context.setContent(actionContent); } } else if (ctx.utils.isEnd()) { context.showEnd(actionContent); } else { context.setContent(actionContent); } updateActionCache(ctx); MvcEventPublisher.Instance.EndProcessAction(context.ctx); }
public override void Process( ProcessContext context ) { MvcEventPublisher.Instance.BeginProcessAction( context.ctx ); if (context.ctx.utils.isSkipCurrentProcessor()) return; MvcContext ctx = context.ctx; ControllerBase controller = context.getController(); // 检查缓存 CacheInfo ci = CacheInfo.Init( ctx ); Object cacheContent = ci.CheckCache(); if (cacheContent != null) { logger.Info( "load from actionCache=" + ci.CacheKey ); context.setContent( cacheContent.ToString() ); getPageMetaFromCache( ctx, ci.CacheKey ); return; } MethodInfo actionMethod = ctx.ActionMethodInfo; // context.getActionMethod(); // 设值模板并载入全局变量 setControllerView( controller, actionMethod ); // 运行并处理post值 ActionRunner.runAction( ctx, controller, actionMethod, controller.utils.runAction ); String actionContent = controller.utils.getActionResult(); // 加入缓存 if (ci.IsActionCache) { ci.AddContentToCache( actionContent ); // 加入PageMeta addPageMetaToCache( ctx, ci.CacheKey ); } actionContent = PostValueProcessor.ProcessPostValue( actionContent, ctx ); if (ctx.utils.isAjax) { context.showEnd( actionContent ); } else if (ctx.utils.isFrame()) { int intNoLayout = ctx.utils.getNoLayout(); if (intNoLayout == 0) { String content = MvcUtil.getFrameContent( actionContent ); context.showEnd( content ); } else { context.setContent( actionContent ); } } else if (ctx.utils.isEnd()) { context.showEnd( actionContent ); } else { context.setContent( actionContent ); } updateActionCache( ctx ); MvcEventPublisher.Instance.EndProcessAction( context.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)); } }