예제 #1
0
파일: JFinalConfig.java 프로젝트: cnzzs/zjf
  /**
   * controller
   *
   * @param me
   */
  @Override
  public void configRoute(Routes me) {

    //        String path = this.getClass().getClassLoader().getResource("").getPath();
    controlSscan(controlPackage); // 获取需要扫描的包

    // 扫描器
    Scan driven = new Scan();
    for (String pake : controlPackage) {
      Set<Class<?>> clazzs = driven.getClasses(pake);
      /*System.out.println("pake: " + pake);*/
      for (Class<?> clazz : clazzs) {
        //            	System.out.println(clazz.getSuperclass());
        LOG.info(clazz.getName());
        Class<?> superclass = clazz.getSuperclass();
        Class<?> jfClz = com.jfinal.core.Controller.class;
        if (superclass == jfClz || superclass.getSuperclass() == jfClz) {
          C con = clazz.getAnnotation(C.class);
          if (null != con) {
            me.add(con.value(), (Class<? extends Controller>) clazz);
          }
        }
      }
    }
  }
예제 #2
0
 @SuppressWarnings("unchecked")
 public void configRoute(Routes routes) {
   List<Class<Controller>> controllerClassList = ClassScaner.scanSubClass(Controller.class);
   if (controllerClassList != null) {
     for (Class<?> clazz : controllerClassList) {
       RouterMapping urlMapping = clazz.getAnnotation(RouterMapping.class);
       if (null != urlMapping && StringUtils.isNotBlank(urlMapping.url())) {
         if (StrKit.notBlank(urlMapping.viewPath())) {
           routes.add(
               urlMapping.url(), (Class<? extends Controller>) clazz, urlMapping.viewPath());
         } else {
           routes.add(urlMapping.url(), (Class<? extends Controller>) clazz);
         }
       }
     }
   }
 }
예제 #3
0
 /** 配置路由 */
 public void configRoute(Routes me) {
   logger.info("配置路由开始..");
   me.add("/", IndexController.class); // 第三个参数为该Controller的视图存放路径
   me.add("/index", IndexController.class, "/");
   me.add("/blog", BlogController.class, "/blog"); // 第三个参数省略时默认与第一个参数值相同,在此即为
   me.add("/admins", AdminsController.class, "/admins"); // 按照bootstrap模板开发而成
   me.add("/user", UserController.class, "/user"); // 用户
   me.add("/liuyanban", LiuyanbanController.class, "/liuyanban");
   me.add("/beauty", BeautyController.class, "/beauty"); // 美图
   me.add("/video", VideoController.class, "/video"); // 视频
   logger.info("配置路由结束..");
 }
예제 #4
0
파일: Conf.java 프로젝트: dao2014/weixin
 public void configRoute(Routes me) {
   me.add("/", IndexController.class);
   me.add("/user", UserController.class);
   me.add("/directAnser", DirectAnswerControlle.class);
   me.add("/direct", DirectControlle.class);
   me.add("/msg", WeixinMsgController.class);
   me.add("/api", WeixinApiController.class, "/api");
 }
예제 #5
0
  /** 启动插件 */
  @Override
  public boolean start() {
    Set<String> excludedMethodName = buildExcludedMethodName();
    ConcurrentMap<String, AuthzHandler> authzMaps = new ConcurrentHashMap<String, AuthzHandler>();
    // 逐个访问所有注册的Controller,解析Controller及action上的所有Shiro注解。
    // 并依据这些注解,actionKey提前构建好权限检查处理器。
    for (Entry<String, Class<? extends Controller>> entry : routes.getEntrySet()) {
      Class<? extends Controller> controllerClass = entry.getValue();

      String controllerKey = entry.getKey();

      // 获取Controller的所有Shiro注解。
      List<Annotation> controllerAnnotations = getAuthzAnnotations(controllerClass);
      // 逐个遍历方法。
      Method[] methods = controllerClass.getMethods();
      for (Method method : methods) {
        // 排除掉Controller基类的所有方法,并且只关注没有参数的Action方法。
        if (!excludedMethodName.contains(method.getName())
            && method.getParameterTypes().length == 0) {
          // 若该方法上存在ClearShiro注解,则对该action不进行访问控制检查。
          if (isClearShiroAnnotationPresent(method)) {
            continue;
          }
          // 获取方法的所有Shiro注解。
          List<Annotation> methodAnnotations = getAuthzAnnotations(method);
          // 依据Controller的注解和方法的注解来生成访问控制处理器。
          AuthzHandler authzHandler = createAuthzHandler(controllerAnnotations, methodAnnotations);
          // 生成访问控制处理器成功。
          if (authzHandler != null) {
            // 构建ActionKey,参考ActionMapping中实现
            String actionKey = createActionKey(controllerClass, method, controllerKey);
            // 添加映射
            authzMaps.put(actionKey, authzHandler);
          }
        }
      }
    }
    // 注入到ShiroKit类中。ShiroKit类以单例模式运行。
    ShiroKit.init(jdbcAuthzService, authzMaps, isAnd);
    return true;
  }
예제 #6
0
  @Override
  public void configRoute(Routes me) {
    log.info("配置基本页面路由");
    me.add("/", IndexController.class);
    me.add("/test", TestController.class);
    me.add("/user", UserController.class);
    me.add("/get", GetRecord.class);

    log.info("配置省级用户页面的路由");
    me.add("/province/provincerecord", ProvinceRecordController.class);
    me.add("/province/sub", SubController.class);
    me.add("/province/pro", ProjectController.class);
    me.add("/province/tree", TreeController.class);
    me.add("/province/cityrecord", CityRecordController.class);
    me.add("/province/countyrecord", CountyRecordControll.class);
    me.add("/province/rfc", ProvinceRfcController.class);

    log.info("配置市级用户页面的路由");
    me.add("/city/cityrecord", CityRecordControllerCity.class);
    me.add("/city/countyrecord", CountyControllerCity.class);
    log.info("配置县级用户页面的路由");
    me.add("/county", CountyControllerCounty.class);
  }
예제 #7
0
 /** 配置路由 */
 public void configRoute(Routes me) {
   routes = me;
   AutoBindRoutes r =
       new AutoBindRoutes("cn.brent.console.webapp.action").suffix("Action").pathPrefix("action");
   routes.add(r);
 }
예제 #8
0
 /** 配置路由 */
 public void configRoute(Routes me) {
   me.add(new Router());
 }
예제 #9
0
 @Override
 public void configRoute(Routes me) {
   me.add(new AdminRoutes());
   me.add(new FrontRoutes());
   me.add(new RemoteRoutes());
 }
예제 #10
0
 @Override
 public void configRoute(Routes me) {
   // TODO Auto-generated method stub
   me.add("/html", HTML_selectsql.class);
   me.add("/json", JSON_selectsql.class);
 }
예제 #11
0
 /** 配置路由 */
 @Override
 public void configRoute(Routes me) {
   me.add("/", CommonController.class);
   me.add("/sysadmin", AdminController.class);
   me.add("/article", ArticleController.class);
 }
예제 #12
0
 @Override
 public void configMoreRoutes(Routes me) {
   // 指定/controller
   me.add("/", DashboardController.class);
 }
예제 #13
0
파일: KMSConfig.java 프로젝트: hbr-pc/fun
 @Override
 public void configRoute(Routes me) {
   // TODO Auto-generated method stub
   //		me.add(new SecurityRoutes());
   me.add("/security/randomCode", LoginController.class);
 }
예제 #14
0
파일: Myconfig.java 프로젝트: jfinal/iver
 /** 配置路由 */
 public void configRoute(Routes me) {
   me.add("/", IndexController.class).add("/topic", TopicController.class);
   me.add("/post", PostController.class).add("/reply", ReplyController.class);
   me.add("/admin/welcome", WelcomeController.class).add("/admin/module", ModuleController.class);
 }
예제 #15
0
 @Override
 public void configRoute(Routes me) {
   // TODO Auto-generated method stub
   me.add("/hello", HelloController.class);
 }
예제 #16
0
 public void configRoute(Routes me) {
   me.add("/hello", HelloController.class);
 }
예제 #17
0
 public void configRoute(Routes me) {
   me.add(new FrontRoutes()); // 前端路由
   me.add(new AdminRoutes()); // 后端路由
 }
예제 #18
0
 /**
  * Config route Config the AutoBindRoutes 自动bindRoute。controller命名为xxController。<br>
  * AutoBindRoutes自动取xxController对应的class的Controller之前的xx作为controllerKey(path)<br>
  * 如:MyUserController => myuser; UserController => user; UseradminController => useradmin<br>
  */
 public void configRoute(Routes me) {
   me.add(new AutoBindRoutes());
   // config others
   configMoreRoutes(me);
 }