当前位置: 首页>>代码示例>>Java>>正文


Java Invocation.invoke方法代码示例

本文整理汇总了Java中com.jfinal.aop.Invocation.invoke方法的典型用法代码示例。如果您正苦于以下问题:Java Invocation.invoke方法的具体用法?Java Invocation.invoke怎么用?Java Invocation.invoke使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jfinal.aop.Invocation的用法示例。


在下文中一共展示了Invocation.invoke方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: intercept

import com.jfinal.aop.Invocation; //导入方法依赖的package包/类
@Override
public void intercept(Invocation inv) {
    try {
        JbootWechatController controller = (JbootWechatController) inv.getController();
        ApiConfig config = controller.getApiConfig();

        if (config == null) {
            inv.getController().renderText("error : cannot get apiconfig,please config jboot.properties");
            return;
        }

        ApiConfigKit.setThreadLocalAppId(config.getAppId());
        inv.invoke();
    } finally {
        ApiConfigKit.removeThreadLocalAppId();
    }
}
 
开发者ID:yangfuhai,项目名称:jboot,代码行数:18,代码来源:WechatApiConfigInterceptor.java

示例2: intercept

import com.jfinal.aop.Invocation; //导入方法依赖的package包/类
public void intercept(Invocation inv) {
    JCache cache = getCache();
    Jedis jedis = cache.getThreadLocalJedis();
    if (jedis != null) {
        inv.invoke();
        return ;
    }

    try {
        jedis = cache.jedisPool.getResource();
        cache.setThreadLocalJedis(jedis);
        inv.invoke();
    }
    finally {
        cache.removeThreadLocalJedis();
        jedis.close();
    }
}
 
开发者ID:gumutianqi,项目名称:jfinal-plus,代码行数:19,代码来源:JRedisInterceptor.java

示例3: intercept

import com.jfinal.aop.Invocation; //导入方法依赖的package包/类
@Override
public void intercept(Invocation ai) {
    Controller controller = ai.getController();
    HttpServletRequest request = controller.getRequest();
    //webRoot
    controller.setAttr("_webRootPath", request.getScheme() + "://"
            + request.getServerName() + (request.getServerPort() == 80 ? "" : ":" + request.getServerPort())
            + request.getContextPath());

    ai.invoke();

    if (!ReturnKit.isJson(controller)) {
        //local 数据
        controller.setAttr("_localParas", request.getQueryString());
        controller.setAttr("_localUri", ai.getActionKey());
    }
}
 
开发者ID:gumutianqi,项目名称:jfinal-plus,代码行数:18,代码来源:URLInterceptor.java

示例4: doIntercept

import com.jfinal.aop.Invocation; //导入方法依赖的package包/类
private void doIntercept(Invocation invocation) {
    long start = System.currentTimeMillis();
    //未安装情况下无法设置缓存
    if (!ZrlogConfig.isInstalled()) {
        invocation.getController().render("/install/index.jsp");
    } else {
        if (invocation.getController() instanceof BaseController) {
            HttpServletRequest request = invocation.getController().getRequest();
            BaseController baseController = ((BaseController) invocation.getController());
            baseController.setAttr("requrl", ZrlogUtil.getFullUrl(request));
            cacheService.refreshInitDataCache(baseController, false);
            lastAccessTime = System.currentTimeMillis();
        }
    }
    invocation.invoke();
    //开发环境下面打印整个请求的耗时,便于优化代码
    if (BlogBuildInfoUtil.isDev()) {
        LOGGER.info(invocation.getActionKey() + " used time " + (System.currentTimeMillis() - start));
    }
}
 
开发者ID:94fzb,项目名称:zrlog,代码行数:21,代码来源:InitDataInterceptor.java

示例5: intercept

import com.jfinal.aop.Invocation; //导入方法依赖的package包/类
@Override
public void intercept(Invocation inv) {
    if(inv.getActionKey().equals("/")){
        inv.getController().render("/login/login.html");
    }else if(inv.getActionKey().equals("/users/login")){
        inv.invoke();
    }else {
        String uid = inv.getController().getPara("uid");
        if(uid!=null) {
            int prefix = uid.indexOf("#");
            if (prefix > 0) {
                uid = uid.replace("#", "");
            }
            if (uid != null) {
                List<UserModel> users = UserModel.me.find("select * from bee_users where uid=?", uid);
                if (users.size() == 1) {
                    inv.getController().setAttr("userid", users.get(0).get("id"));
                    inv.getController().setAttr("usergroup", users.get(0).get("workgroup"));
                    inv.invoke();
                    return;
                }
            }
        }
        inv.getController().renderText("{'issuccess':false,'data':{},'message':'身份验证失败,请重新登陆.'}");
    }
}
 
开发者ID:guangchiguangchi,项目名称:little-bee,代码行数:27,代码来源:LoginInterceptor.java

示例6: intercept

import com.jfinal.aop.Invocation; //导入方法依赖的package包/类
@Override
public void intercept(Invocation invocation) {
    if (invocation.getController() instanceof BaseController) {
        BaseController baseController = (BaseController) invocation.getController();
        String ipStr = baseController.getStrValueByKey("blackList");
        if (ipStr != null) {
            Set<String> ipSet = new HashSet<>(Arrays.asList(ipStr.split(",")));
            String requestIP = WebTools.getRealIp(baseController.getRequest());
            if (ipSet.contains(requestIP)) {
                baseController.render(JFinal.me().getConstants().getErrorView(403));
            } else {
                invocation.invoke();
            }
        } else {
            invocation.invoke();
        }
    } else {
        invocation.invoke();
    }
}
 
开发者ID:94fzb,项目名称:zrlog,代码行数:21,代码来源:BlackListInterceptor.java

示例7: intercept

import com.jfinal.aop.Invocation; //导入方法依赖的package包/类
@Override
public void intercept(Invocation inv) {
	try {
		inv.invoke();
	} catch(Exception e) {
		BaseController controller = (BaseController)inv.getController();
		String exceptionMessage = "Oop~ Server Exception";
		Throwable t = e.getCause();
		if(t != null) exceptionMessage = t.getMessage();
		else if(StrKit.notBlank(e.getMessage())) exceptionMessage = e.getMessage();
		else e.printStackTrace();
		controller.Error(500, isDebug ? exceptionMessage : null);
	}
}
 
开发者ID:slashchenxiaojun,项目名称:wall.e,代码行数:15,代码来源:ErrorInterceptor.java

示例8: intercept

import com.jfinal.aop.Invocation; //导入方法依赖的package包/类
@Override
public void intercept(Invocation inv) {
    if (!config.isServerEnable()) {
        inv.getController().renderJson(Ret.fail("msg", "sorry,  you have no permission to visit this page. "));
        return;
    }

    inv.invoke();
}
 
开发者ID:yangfuhai,项目名称:jboot,代码行数:10,代码来源:JbootConfigInterceptor.java

示例9: intercept

import com.jfinal.aop.Invocation; //导入方法依赖的package包/类
@Override
public void intercept(Invocation inv) {
    ZkClient zkClient=inv.getController().getSessionAttr("zk-client");
    if(zkClient!=null) {
        inv.invoke();
    }else{
        inv.getController().redirect("/index.html");
    }

}
 
开发者ID:iminto,项目名称:zooadmin,代码行数:11,代码来源:AuthInterceptor.java

示例10: intercept

import com.jfinal.aop.Invocation; //导入方法依赖的package包/类
@Override
public void intercept(Invocation inv) {
	logger.info("================Before invoking:{}", inv.getActionKey());
	inv.invoke();
	logger.info("================After invoking:{}", inv.getActionKey());
	
}
 
开发者ID:xuxueli,项目名称:xxl-incubator,代码行数:8,代码来源:BlogInterceptor.java

示例11: intercept

import com.jfinal.aop.Invocation; //导入方法依赖的package包/类
public void intercept(Invocation ai) {

		try {
			ai.invoke();
		} catch (Exception e) {
			log.error("异常:", e);
			Controller controller = ai.getController();
			controller.setAttr("error", e.toString());
			controller.render(Config.getStr("PAGES.500"));
		}

	}
 
开发者ID:jflyfox,项目名称:jflyfox_jfinal,代码行数:13,代码来源:ExceptionInterceptor.java

示例12: intercept

import com.jfinal.aop.Invocation; //导入方法依赖的package包/类
public void intercept(Invocation ai) {

		Controller controller = ai.getController();

		HttpServletRequest request = controller.getRequest();
		HttpSession session = request.getSession();
		Object obj = session.getAttribute(Attr.SESSION_IS_MOILE);
		if (obj == null) {
			boolean isMoile = HttpRequestDeviceUtils.isMobileDevice(request);
			session.setAttribute(Attr.SESSION_IS_MOILE, isMoile);
		}

		ai.invoke();
	}
 
开发者ID:jflyfox,项目名称:jflyfox_jfinal,代码行数:15,代码来源:SessionAttrInterceptor.java

示例13: intercept

import com.jfinal.aop.Invocation; //导入方法依赖的package包/类
public void intercept(Invocation ai) {

		Controller controller = ai.getController();

		// 设置公共属性
		if (controller instanceof BaseController) {
			BaseForm form = ((BaseController) controller).getModelByForm(BaseForm.class);
			controller.setAttr("form", form);
		}

		ai.invoke();
	}
 
开发者ID:jflyfox,项目名称:jflyfox_jfinal,代码行数:13,代码来源:JflyfoxInterceptor.java

示例14: intercept

import com.jfinal.aop.Invocation; //导入方法依赖的package包/类
@Override
public void intercept(Invocation inv) {
    AuthzHandler ah = ShiroKit.getAuthzHandler(inv.getActionKey());
    // 存在访问控制处理器。
    if (ah != null) {
        try {
            // 执行权限检查。
            ah.assertAuthorized();
        } catch (UnauthenticatedException lae) {
            // RequiresGuest,RequiresAuthentication,RequiresUser,未满足时,抛出未经授权的异常。
            // 如果没有进行身份验证,返回HTTP401状态码
            inv.getController().renderError(401);
            return;
        } catch (AuthorizationException ae) {
            // RequiresRoles,RequiresPermissions授权异常
            // 如果没有权限访问对应的资源,返回HTTP状态码403。
            inv.getController().renderError(403);
            return;
        } catch (Exception e) {
            // 出现了异常,应该是没有登录。
            inv.getController().renderError(401);
            return;
        }
    }
    // 执行正常逻辑
    inv.invoke();
}
 
开发者ID:gumutianqi,项目名称:jfinal-plus,代码行数:28,代码来源:ShiroInterceptor.java

示例15: intercept

import com.jfinal.aop.Invocation; //导入方法依赖的package包/类
@Override
public void intercept(Invocation ai) {
    try {
        ai.invoke();
    } catch (Exception e) {
        ExceptionRender exceptionRender = matchRender(e);
        if (exceptionRender == null) {
            exceptionRender = defaultRender;
        }
        if (exceptionRender != null) {
            ai.getController().render(exceptionRender.setException(e));
        }
    }
}
 
开发者ID:gumutianqi,项目名称:jfinal-plus,代码行数:15,代码来源:ExceptionInterceptor.java


注:本文中的com.jfinal.aop.Invocation.invoke方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。