com.jfinal.config.Routes Java Examples

The following examples show how to use com.jfinal.config.Routes. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JfinalHttpFramework.java    From xDoc with MIT License 6 votes vote down vote up
@Override
public List<ApiModule> extend(List<ApiModule> apiModules) {

    apiModules = super.extend(apiModules);


    Routes routes = ConfigGetter.getRoutes();
    List<Routes.Route> routeItemList = routes.getRouteItemList();

    Map<Class, String> controllerMap = new HashMap<>();
    for (Routes.Route route : routeItemList) {
        controllerMap.put(route.getControllerClass(), route.getControllerKey());
    }

    for (ApiModule apiModule : apiModules) {
        for (int i = 0; i < apiModule.getApiActions().size(); i++) {
            HttpApiAction apiAction = (HttpApiAction) apiModule.getApiActions().get(i);
            apiAction.setJson(false);//TODO 该属性需要去掉
            apiAction.setUris(Arrays.asList(controllerMap.get(apiModule.getType()) + "/" + apiAction.getMethod().getName()));
            apiAction.setMethods(Arrays.asList("ALL"));
        }
    }

    return apiModules;
}
 
Example #2
Source File: AddonControllerManager.java    From jpress with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static void deleteController(Class<? extends Controller> c) {
    RequestMapping mapping = c.getAnnotation(RequestMapping.class);
    if (mapping == null) {
        return;
    }

    String value = AnnotationUtil.get(mapping.value());
    if (value == null) {
        return;
    }

    addonRoutes.getRouteItemList().removeIf(route -> route.getControllerKey().equals(value));
    Routes.getControllerKeySet().removeIf(actionKey -> Objects.equals(actionKey, value));
    controllerAddonMapping.remove(c);
}
 
Example #3
Source File: JbootAppListenerManager.java    From jboot with Apache License 2.0 5 votes vote down vote up
@Override
public void onRouteConfig(Routes routes) {
    for (JbootAppListener listener : listeners) {
        try {
            listener.onRouteConfig(routes);
        } catch (Throwable ex) {
            log.error(ex.toString(), ex);
        }
    }
}
 
Example #4
Source File: JfinalConfigListener.java    From jboot-admin with Apache License 2.0 4 votes vote down vote up
@Override
public void onJfinalRouteConfig(Routes routes) {
    routes.setBaseViewPath("/template");
}
 
Example #5
Source File: WeixinConfig.java    From jfinal-weixin with Apache License 2.0 4 votes vote down vote up
public void configRoute(Routes me) {
	me.add("/msg", WeixinMsgController.class);
	me.add("/api", WeixinApiController.class, "/api");
	me.add("/pay", WeixinPayController.class);
}
 
Example #6
Source File: AddonControllerManager.java    From jpress with GNU Lesser General Public License v3.0 4 votes vote down vote up
public AddonActionMapping(Routes routes) {
    super(routes);
    this.mapping = new ConcurrentHashMap<>();
}
 
Example #7
Source File: JPressCoreInitializer.java    From jpress with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void onRouteConfig(Routes routes) {
    routes.setClearAfterMapping(false);
}
 
Example #8
Source File: ConfigGetter.java    From xDoc with MIT License 4 votes vote down vote up
public static Routes getRoutes() {
    return Config.getRoutes();
}
 
Example #9
Source File: TestAppListener.java    From jboot with Apache License 2.0 4 votes vote down vote up
@Override
public void onRouteConfig(Routes routes) {
    System.out.println("TestAppListener.onRouteConfig");
}
 
Example #10
Source File: JbootShiroManager.java    From jboot with Apache License 2.0 4 votes vote down vote up
public void init(List<Routes.Route> routes) {
    if (!jbootShiroConfig.isConfigOK()) {
        return;
    }
    initInvokers(routes);
}
 
Example #11
Source File: XlsConfig.java    From jfinal-ext3 with Apache License 2.0 4 votes vote down vote up
@Override
public void configRoute(Routes me) {
    me.add("/poi", XlsController.class);
}
 
Example #12
Source File: JFinalKit.java    From jfinal-ext3 with Apache License 2.0 4 votes vote down vote up
public static Routes getRoutes() {
    return JFinalKit.routes;
}
 
Example #13
Source File: JfinalConfigListener.java    From jboot-admin with Apache License 2.0 4 votes vote down vote up
@Override
public void onJfinalRouteConfig(Routes routes) {
    routes.setBaseViewPath("/template");
}
 
Example #14
Source File: JfinalConfigListener.java    From jboot-admin with Apache License 2.0 4 votes vote down vote up
@Override
public void onJfinalRouteConfig(Routes routes) {
    routes.setBaseViewPath("/template");
}
 
Example #15
Source File: DemoConfig.java    From sqlhelper with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * 配置路由
 */
public void configRoute(Routes me) {
	me.add("/", IndexController.class, "/index");	// 第三个参数为该Controller的视图存放路径
	me.add("/blog", BlogController.class);			// 第三个参数省略时默认与第一个参数值相同,在此即为 "/blog"
}
 
Example #16
Source File: ApiConfigPropDemo.java    From jfinal-ext3 with Apache License 2.0 2 votes vote down vote up
@Override
public void configMoreRoutes(Routes me) {
	
}
 
Example #17
Source File: TestConfig.java    From jfinal-ext3 with Apache License 2.0 2 votes vote down vote up
@Override
public void configMoreRoutes(Routes me) {
	
}
 
Example #18
Source File: StandaloneAppConfig.java    From jfinal-ext3 with Apache License 2.0 2 votes vote down vote up
@Override
public void configMoreRoutes(Routes me) {
	
}
 
Example #19
Source File: JFinalConfigExt.java    From jfinal-ext3 with Apache License 2.0 2 votes vote down vote up
/**
 * 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);
}
 
Example #20
Source File: JFinalConfigExt.java    From jfinal-ext3 with Apache License 2.0 2 votes vote down vote up
/**
 * Config other more route
 */
public abstract void configMoreRoutes(Routes me);
 
Example #21
Source File: JbootAppListener.java    From jboot with Apache License 2.0 votes vote down vote up
public void onRouteConfig(Routes routes);