當前位置: 首頁>>代碼示例>>Java>>正文


Java Route類代碼示例

本文整理匯總了Java中play.mvc.Router.Route的典型用法代碼示例。如果您正苦於以下問題:Java Route類的具體用法?Java Route怎麽用?Java Route使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Route類屬於play.mvc.Router包,在下文中一共展示了Route類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onApplicationStart

import play.mvc.Router.Route; //導入依賴的package包/類
@Override
public void onApplicationStart() {

	final Set<Class<?>> resourceClasses = 
			ApiHelpInventory.getInstance().getRootResources();		

	if (resourceClasses.size() > 0) {

		Map<String, Route> router = new HashMap<>();

		for(Route route : Router.routes){ 	
			router.put(route.action, route);
		}

		RouteWrapper routeWrapper = new RouteWrapper(router);
		RouteFactory.setRoute(routeWrapper);

		PlaySwaggerConfig playSwaggerConfig = new PlaySwaggerConfig();			
		PlayConfigFactory.setConfig(playSwaggerConfig);

		Router.prependRoute("GET", RESOURCES_JSON, "ApiHelpController.catchAll");
		Logger.info("Swagger: Added ROOT help api @ " + RESOURCES_JSON);
	}
}
 
開發者ID:abhishekShukla,項目名稱:swagger-play,代碼行數:25,代碼來源:SwaggerPlugin.java

示例2: RouteWrapper

import play.mvc.Router.Route; //導入依賴的package包/類
public RouteWrapper(Map<String, Route> router) {
    this.router = router;
}
 
開發者ID:abhishekShukla,項目名稱:swagger-play,代碼行數:4,代碼來源:RouteWrapper.java

示例3: get

import play.mvc.Router.Route; //導入依賴的package包/類
public Route get(String routeName) {
    return router.get(routeName);
}
 
開發者ID:abhishekShukla,項目名稱:swagger-play,代碼行數:4,代碼來源:RouteWrapper.java

示例4: getAll

import play.mvc.Router.Route; //導入依賴的package包/類
public Map<String, Route> getAll() {
    return router;
}
 
開發者ID:abhishekShukla,項目名稱:swagger-play,代碼行數:4,代碼來源:RouteWrapper.java

示例5: onRequestRouting

import play.mvc.Router.Route; //導入依賴的package包/類
@Override
public void onRequestRouting(Route route) {
    // Logger.info("onRequestRouting:" + route.path + " requestId:" +
    // ProfilerEnhancer.currentRequestId());
    super.onRequestRouting(route);
}
 
開發者ID:PerfectCarl,項目名稱:play-profiler,代碼行數:7,代碼來源:ProfilerPlugin.java

示例6: resolve

import play.mvc.Router.Route; //導入依賴的package包/類
@SuppressWarnings("unchecked")
public static void resolve(Http.Request request, Http.Response response) {

    if (!Play.started) {
        return;
    }

    Http.Request.current.set(request);
    Http.Response.current.set(response);

    Scope.Params.current.set(request.params);
    Scope.RenderArgs.current.set(new Scope.RenderArgs());
    Scope.RouteArgs.current.set(new Scope.RouteArgs());
    Scope.Session.current.set(Scope.Session.restore());
    Scope.Flash.current.set(Scope.Flash.restore());
    CachedBoundActionMethodArgs.init();

    ControllersEnhancer.currentAction.set(new Stack<String>());

    if (request.resolved) {
        return;
    }

    // Route and resolve format if not already done
    if (request.action == null) {
        Play.pluginCollection.routeRequest(request);
        Route route = Router.route(request);
        Play.pluginCollection.onRequestRouting(route);
    }
    request.resolveFormat();

    // Find the action method
    try {
        Method actionMethod = null;
        Object[] ca = getActionMethod(request.action);
        actionMethod = (Method) ca[1];
        request.controller = ((Class) ca[0]).getName().substring(12).replace("$", "");
        request.controllerClass = ((Class) ca[0]);
        request.actionMethod = actionMethod.getName();
        request.action = request.controller + "." + request.actionMethod;
        request.invokedMethod = actionMethod;

        if (Logger.isTraceEnabled()) {
            Logger.trace("------- %s", actionMethod);
        }

        request.resolved = true;

    } catch (ActionNotFoundException e) {
        Logger.error(e, "%s action not found", e.getAction());
        throw new NotFound(String.format("%s action not found", e.getAction()));
    }

}
 
開發者ID:eBay,項目名稱:restcommander,代碼行數:55,代碼來源:ActionInvoker.java

示例7: onRequestRouting

import play.mvc.Router.Route; //導入依賴的package包/類
/**
 * Called when the request has been routed.
 * @param route The route selected.
 */
public void onRequestRouting(Route route) {
}
 
開發者ID:eBay,項目名稱:restcommander,代碼行數:7,代碼來源:PlayPlugin.java


注:本文中的play.mvc.Router.Route類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。