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

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

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

JFinal.getAllActionKeys介绍

暂无

代码示例

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

  1. /**
  2. * 构建 action 的权限,每个Controller的方法对应一个action
  3. *
  4. * @return
  5. */
  6. private static List<Permission> buildActionPermissions() {
  7. List<Permission> permissions = new ArrayList<>();
  8. List<String> allActionKeys = JFinal.me().getAllActionKeys();
  9. String[] urlPara = new String[1];
  10. for (String actionKey : allActionKeys) {
  11. // 只处理后台的权限 和 API的权限
  12. if (actionKey.startsWith("/admin") || actionKey.startsWith("/api")) {
  13. Action action = JFinal.me().getAction(actionKey, urlPara);
  14. if (action == null || excludedMethodName.contains(action.getMethodName())) {
  15. continue;
  16. }
  17. AdminPermission permissionAnnotation = action.getMethod().getAnnotation(AdminPermission.class);
  18. String text = permissionAnnotation == null ? null : permissionAnnotation.value();
  19. String controller = action.getControllerClass().getName();
  20. Permission permission = new Permission();
  21. permission.setActionKey(actionKey);
  22. permission.setNode(controller);
  23. permission.setText(text);
  24. permission.setType(Permission.TYPE_ACTION);
  25. permissions.add(permission);
  26. }
  27. }
  28. return permissions;
  29. }

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

  1. private static List<MenuItem> buildUCenterMenuItems() {
  2. List<MenuItem> adminMenuItems = new ArrayList<>();
  3. List<String> allActionKeys = JFinal.me().getAllActionKeys();
  4. String[] urlPara = new String[1];
  5. for (String actionKey : allActionKeys) {
  6. // 只处理后台的权限 和 API的权限
  7. if (actionKey.startsWith("/ucenter")) {
  8. Action action = JFinal.me().getAction(actionKey, urlPara);
  9. if (action == null || excludedMethodName.contains(action.getMethodName())) {
  10. continue;
  11. }
  12. UCenterMenu adminMenu = action.getMethod().getAnnotation(UCenterMenu.class);
  13. if (adminMenu == null) {
  14. continue;
  15. }
  16. MenuItem menu = new MenuItem();
  17. menu.setText(adminMenu.text());
  18. menu.setIcon(adminMenu.icon());
  19. menu.setGroupId(adminMenu.groupId());
  20. menu.setUrl(actionKey);
  21. menu.setOrder(adminMenu.order());
  22. adminMenuItems.add(menu);
  23. }
  24. }
  25. return adminMenuItems;
  26. }

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

  1. private static List<MenuItem> buildAdminMenuItems() {
  2. List<MenuItem> adminMenuItems = new ArrayList<>();
  3. List<String> allActionKeys = JFinal.me().getAllActionKeys();
  4. String[] urlPara = new String[1];
  5. for (String actionKey : allActionKeys) {
  6. // 只处理后台的权限 和 API的权限
  7. if (actionKey.startsWith("/admin")) {
  8. Action action = JFinal.me().getAction(actionKey, urlPara);
  9. if (action == null || excludedMethodName.contains(action.getMethodName())) {
  10. continue;
  11. }
  12. AdminMenu adminMenu = action.getMethod().getAnnotation(AdminMenu.class);
  13. if (adminMenu == null) {
  14. continue;
  15. }
  16. MenuItem menu = new MenuItem();
  17. menu.setText(adminMenu.text());
  18. menu.setIcon(adminMenu.icon());
  19. menu.setGroupId(adminMenu.groupId());
  20. menu.setUrl(actionKey);
  21. menu.setOrder(adminMenu.order());
  22. adminMenuItems.add(menu);
  23. }
  24. }
  25. return adminMenuItems;
  26. }

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

  1. 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);
  2. case SC_NOT_FOUND:
  3. final List<String> allActionKeys = JFinal.me().getAllActionKeys();
  4. pdata.put("routes", allActionKeys);
  5. 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

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

相关文章