org.restlet.routing.Router.getDefaultRoute()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(220)

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

Router.getDefaultRoute介绍

[英]Returns the default route to test if no other one was available after retrying the maximum number of attempts.
[中]如果在重试最大尝试次数后没有其他可用路由,则返回要测试的默认路由。

代码示例

代码示例来源:origin: org.restlet.jee/org.restlet.ext.apispark

/**
   * Completes the list of ResourceInfo instances for the given Router
   * instance.
   * 
   * 
   * @param router
   *            The router to document.
   * @param introspectionHelper
   */
  private static void collectForRouter(CollectInfo collectInfo,
      String basePath, Router router, ChallengeScheme scheme,
      List<? extends IntrospectionHelper> introspectionHelper) {
    for (Route route : router.getRoutes()) {
      collectForRoute(collectInfo, basePath, route, scheme,
          introspectionHelper);
    }

    if (router.getDefaultRoute() != null) {
      collectForRoute(collectInfo, basePath, router.getDefaultRoute(),
          scheme, introspectionHelper);
    }
  }
}

代码示例来源:origin: org.restlet.jse/org.restlet.ext.platform

/**
   * Completes the list of ResourceInfo instances for the given Router
   * instance.
   * 
   * 
   * @param router
   *            The router to document.
   * @param introspectionHelper
   */
  private static void collectForRouter(CollectInfo collectInfo,
      String basePath, Router router, ChallengeScheme scheme,
      List<? extends IntrospectionHelper> introspectionHelper) {
    for (Route route : router.getRoutes()) {
      collectForRoute(collectInfo, basePath, route, scheme,
          introspectionHelper);
    }

    if (router.getDefaultRoute() != null) {
      collectForRoute(collectInfo, basePath, router.getDefaultRoute(),
          scheme, introspectionHelper);
    }
  }
}

代码示例来源:origin: org.restlet.gae/org.restlet.ext.platform

/**
   * Completes the list of ResourceInfo instances for the given Router
   * instance.
   * 
   * 
   * @param router
   *            The router to document.
   * @param introspectionHelper
   */
  private static void collectForRouter(CollectInfo collectInfo,
      String basePath, Router router, ChallengeScheme scheme,
      List<? extends IntrospectionHelper> introspectionHelper) {
    for (Route route : router.getRoutes()) {
      collectForRoute(collectInfo, basePath, route, scheme,
          introspectionHelper);
    }

    if (router.getDefaultRoute() != null) {
      collectForRoute(collectInfo, basePath, router.getDefaultRoute(),
          scheme, introspectionHelper);
    }
  }
}

代码示例来源:origin: org.restlet.osgi/org.restlet

/**
 * Logs the route selected.
 * 
 * @param route
 *            The route selected.
 */
protected void logRoute(Route route) {
  if (getLogger().isLoggable(Level.FINE)) {
    if (getDefaultRoute() == route) {
      getLogger().fine("The default route was selected");
    } else {
      getLogger().fine("Selected route: " + route);
    }
  }
}

代码示例来源:origin: org.restlet.osgi/org.restlet

/**
 * Detaches the target from this router. All routes routing to this target
 * Restlet are removed from the list of routes and the default route is set
 * to null.
 * 
 * @param target
 *            The target Restlet to detach.
 */
public void detach(Restlet target) {
  getRoutes().removeAll(target);
  if ((getDefaultRoute() != null)
      && (getDefaultRoute().getNext() == target)) {
    setDefaultRoute(null);
  }
}

代码示例来源:origin: org.restlet.jee/org.restlet.ext.platform

/**
   * Completes the list of ResourceInfo instances for the given Router
   * instance.
   * 
   * 
   * @param router
   *            The router to document.
   * @param introspectionHelper
   */
  private static void collectForRouter(CollectInfo collectInfo,
      String basePath, Router router, ChallengeScheme scheme,
      List<? extends IntrospectionHelper> introspectionHelper) {
    for (Route route : router.getRoutes()) {
      collectForRoute(collectInfo, basePath, route, scheme,
          introspectionHelper);
    }

    if (router.getDefaultRoute() != null) {
      collectForRoute(collectInfo, basePath, router.getDefaultRoute(),
          scheme, introspectionHelper);
    }
  }
}

代码示例来源:origin: org.restlet.osgi/org.restlet.ext.platform

/**
   * Completes the list of ResourceInfo instances for the given Router
   * instance.
   * 
   * 
   * @param router
   *            The router to document.
   * @param introspectionHelper
   */
  private static void collectForRouter(CollectInfo collectInfo,
      String basePath, Router router, ChallengeScheme scheme,
      List<? extends IntrospectionHelper> introspectionHelper) {
    for (Route route : router.getRoutes()) {
      collectForRoute(collectInfo, basePath, route, scheme,
          introspectionHelper);
    }

    if (router.getDefaultRoute() != null) {
      collectForRoute(collectInfo, basePath, router.getDefaultRoute(),
          scheme, introspectionHelper);
    }
  }
}

代码示例来源:origin: org.restlet.jee/org.restlet.ext.wadl

if (router.getDefaultRoute() != null) {
  ResourceInfo resourceInfo = getResourceInfo(applicationInfo,
      router.getDefaultRoute(), "/", request, response);
  if (resourceInfo != null) {
    result.add(resourceInfo);

代码示例来源:origin: org.restlet.osgi/org.restlet

/**
 * Stops the filter and the attached routes.
 */
@Override
public synchronized void stop() throws Exception {
  if (isStarted()) {
    // Must be invoked as a first step
    super.stop();
    if (getDefaultRoute() != null) {
      getDefaultRoute().stop();
    }
    for (Route route : getRoutes()) {
      route.stop();
    }
  }
}

代码示例来源:origin: org.restlet.osgi/org.restlet

/**
 * Starts the filter and the attached routes.
 */
@Override
public synchronized void start() throws Exception {
  if (isStopped()) {
    for (Route route : getRoutes()) {
      route.start();
    }
    if (getDefaultRoute() != null) {
      getDefaultRoute().start();
    }
    // Must be invoked as a last step
    super.start();
  }
}

代码示例来源:origin: org.restlet.osgi/org.restlet

/**
 * Detaches the target from this router. All routes routing to this target
 * Restlet are removed from the list of routes and the default route is set
 * to null.
 * 
 * @param targetClass
 *            The target class to detach.
 */
public void detach(Class<?> targetClass) {
  for (int i = getRoutes().size() - 1; i >= 0; i--) {
    Restlet target = getRoutes().get(i).getNext();
    if (target != null
        && Finder.class.isAssignableFrom(target.getClass())) {
      Finder finder = (Finder) target;
      if (finder.getTargetClass().equals(targetClass)) {
        getRoutes().remove(i);
      }
    }
  }
  if (getDefaultRoute() != null) {
    Restlet target = getDefaultRoute().getNext();
    if (target != null
        && Finder.class.isAssignableFrom(target.getClass())) {
      Finder finder = (Finder) target;
      if (finder.getTargetClass().equals(targetClass)) {
        setDefaultRoute(null);
      }
    }
  }
}

代码示例来源:origin: org.restlet.osgi/org.restlet

if ((getDefaultRoute() != null)
    && (getDefaultRoute().score(request, response) >= getRequiredScore())) {
  result = getDefaultRoute();
} else {

相关文章