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

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

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

JFinal.getAction介绍

暂无

代码示例

代码示例来源: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: yangfuhai/jboot

@Override
public void handle(String target, HttpServletRequest request, HttpServletResponse response, boolean[] isHandled) {
  if (!webConfig.isActionCacheEnable()) {
    next.handle(target, request, response, isHandled);
    return;
  }
  Action action = JFinal.me().getAction(target, urlPara);
  if (action == null) {
    next.handle(target, request, response, isHandled);
    return;
  }
  ActionCacheClear actionClear = action.getMethod().getAnnotation(ActionCacheClear.class);
  if (actionClear != null) {
    clearActionCache(action, actionClear);
    next.handle(target, request, response, isHandled);
    return;
  }
  EnableActionCache actionCache = getActionCache(action);
  if (actionCache == null) {
    next.handle(target, request, response, isHandled);
    return;
  }
  try {
    exec(target, request, response, isHandled, action, actionCache);
  } finally {
    ActionCacheContext.release();
  }
}

相关文章