com.jfinal.core.JFinal.getAllActionKeys()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(73)

本文整理了Java中com.jfinal.core.JFinal.getAllActionKeys()方法的一些代码示例,展示了JFinal.getAllActionKeys()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JFinal.getAllActionKeys()方法的具体详情如下:
包路径:com.jfinal.core.JFinal
类名称:JFinal
方法名:getAllActionKeys

JFinal.getAllActionKeys介绍

暂无

代码示例

代码示例来源:origin: JpressProjects/jpress

/**
 * 构建 action 的权限,每个Controller的方法对应一个action
 *
 * @return
 */
private static List<Permission> buildActionPermissions() {
  List<Permission> permissions = new ArrayList<>();
  List<String> allActionKeys = JFinal.me().getAllActionKeys();
  String[] urlPara = new String[1];
  for (String actionKey : allActionKeys) {
    // 只处理后台的权限 和 API的权限
    if (actionKey.startsWith("/admin") || actionKey.startsWith("/api")) {
      Action action = JFinal.me().getAction(actionKey, urlPara);
      if (action == null || excludedMethodName.contains(action.getMethodName())) {
        continue;
      }
      AdminPermission permissionAnnotation = action.getMethod().getAnnotation(AdminPermission.class);
      String text = permissionAnnotation == null ? null : permissionAnnotation.value();
      String controller = action.getControllerClass().getName();
      Permission permission = new Permission();
      permission.setActionKey(actionKey);
      permission.setNode(controller);
      permission.setText(text);
      permission.setType(Permission.TYPE_ACTION);
      permissions.add(permission);
    }
  }
  return permissions;
}

代码示例来源:origin: JpressProjects/jpress

private static List<MenuItem> buildUCenterMenuItems() {
  List<MenuItem> adminMenuItems = new ArrayList<>();
  List<String> allActionKeys = JFinal.me().getAllActionKeys();
  String[] urlPara = new String[1];
  for (String actionKey : allActionKeys) {
    // 只处理后台的权限 和 API的权限
    if (actionKey.startsWith("/ucenter")) {
      Action action = JFinal.me().getAction(actionKey, urlPara);
      if (action == null || excludedMethodName.contains(action.getMethodName())) {
        continue;
      }
      UCenterMenu adminMenu = action.getMethod().getAnnotation(UCenterMenu.class);
      if (adminMenu == null) {
        continue;
      }
      MenuItem menu = new MenuItem();
      menu.setText(adminMenu.text());
      menu.setIcon(adminMenu.icon());
      menu.setGroupId(adminMenu.groupId());
      menu.setUrl(actionKey);
      menu.setOrder(adminMenu.order());
      adminMenuItems.add(menu);
    }
  }
  return adminMenuItems;
}

代码示例来源:origin: JpressProjects/jpress

private static List<MenuItem> buildAdminMenuItems() {
  List<MenuItem> adminMenuItems = new ArrayList<>();
  List<String> allActionKeys = JFinal.me().getAllActionKeys();
  String[] urlPara = new String[1];
  for (String actionKey : allActionKeys) {
    // 只处理后台的权限 和 API的权限
    if (actionKey.startsWith("/admin")) {
      Action action = JFinal.me().getAction(actionKey, urlPara);
      if (action == null || excludedMethodName.contains(action.getMethodName())) {
        continue;
      }
      AdminMenu adminMenu = action.getMethod().getAnnotation(AdminMenu.class);
      if (adminMenu == null) {
        continue;
      }
      MenuItem menu = new MenuItem();
      menu.setText(adminMenu.text());
      menu.setIcon(adminMenu.icon());
      menu.setGroupId(adminMenu.groupId());
      menu.setUrl(actionKey);
      menu.setOrder(adminMenu.order());
      adminMenuItems.add(menu);
    }
  }
  return adminMenuItems;
}

代码示例来源:origin: com.github.sogyf/goja-mvt

return Freemarkers.renderStrTemplate("<!DOCTYPE html><html><head><title> Application 500 Eroor </title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/></head><style type=\"text/css\">html, body {margin: 0;padding: 0;font-family : Helvetica, Arial, Sans;background: #EEEEEE;}.block {padding: 20px;border-bottom : 1px solid #aaa;}#header h1 {font-weight : normal;font-size: 28px;margin: 0;}#more {color: #666;font-size : 80%;border: none;}#header {background : #fcd2da;}#header p {color : #333;}#source {background : #f6f6f6;}#source h2 {font-weight : normal;font-size: 18px;margin: 0 0 10px 0;}#source .lineNumber {float: left;display: block;width: 40px;text-align: right;margin-right : 10px;font-size: 14px;font-family: monospace;background: #333;color: #fff;}#source .line {clear: both;color: #333;margin-bottom : 1px;}#source pre {font-size: 14px;margin: 0;overflow-x : hidden;}#source .error {color : #c00 !important;}#source .error .lineNumber {background : #c00;}#source a {text-decoration : none;}#source a:hover * {cursor : pointer !important;}#source a:hover pre {background : #FAFFCF !important;}#source em {font-style: normal;text-decoration : underline;font-weight: bold;}#source strong {font-style: normal;font-weight : bold;}</style><body><div id=\"header\" class=\"block\"><h1>Execution exception</h1><p> ${title!} </p></div><div id=\"source\" class=\"block\"><h2>Exception information in detail </h2><#list errors as er><div class=\"line <#if er?starts_with(\"\tat app.\")>error</#if>\"><span class=\"lineNumber\">${er_index + 1}:</span><pre>${er}</pre></div></#list></div></body></html>", pdata);
case SC_NOT_FOUND:
  final List<String> allActionKeys = JFinal.me().getAllActionKeys();
  pdata.put("routes", allActionKeys);
  return Freemarkers.renderStrTemplate("<!DOCTYPE html><html><head><title>Not found</title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/></head><style type=\"text/css\">html, body {margin: 0;padding: 0;font-family: Helvetica, Arial, Sans;background: #EEEEEE;}.block {padding: 20px;border-bottom: 1px solid #aaa;}#header h1 {font-weight: normal;font-size: 28px;margin: 0;}#more {color: #666;font-size: 80%;border: none;}#header {background: #FFFFCC;}#header p {color: #333;}#routes {background: #f6f6f6;}#routes h2 {font-weight: normal;font-size: 18px;margin: 0 0 10px 0;}#routes ol {}#routes li {font-size: 14px;font-family: monospace;color: #333;}</style><body><div id=\"header\" class=\"block\"><h1>${requestURI!}  Not found</h1></div><div id=\"routes\" class=\"block\"><h2>These routes have been tried, in this order :</h2><ol><#list routes as r><li> ${r} </li></#list></ol></div></body></html>", pdata);

代码示例来源:origin: yangfuhai/jboot

String callbackControllerKey = controllerKey + "/wechatCallback";
if (!JFinal.me().getAllActionKeys().contains(callbackControllerKey)) {
  callbackControllerKey = controllerKey.substring(0, controllerKey.lastIndexOf("/")) + "/wechatCallback";

相关文章