private List getLinkList() { List l = new ArrayList(); Iterator it = myRouter.getRoutes().iterator(); while (it.hasNext()) { Route r = (Route) it.next(); String pattern = r.getTemplate().getPattern(); if (!pattern.contains("{") && (pattern.length() > 1)) { l.add(pattern.substring(1)); // trim leading slash } } return l; } }
/** * Attaches a target Restlet to this router based on a given URI pattern. A * new route will be added routing to the target when calls with a URI * matching the pattern will be received. * * @param uriPattern * The URI pattern that must match the relative part of the * resource URI. * @param target * The target Restlet to attach. * @return The created route. */ public Route attach(String uriPattern, Restlet target) { final Route result = createRoute(uriPattern, target); getRoutes().add(result); return result; }
/** * 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); } }
result = getRoutes().getBest(request, response, getRequiredScore()); break; result = getRoutes().getFirst(request, response, getRequiredScore()); break; result = getRoutes().getLast(request, response, getRequiredScore()); break; result = getRoutes().getNext(request, response, getRequiredScore()); break; result = getRoutes().getRandom(request, response, getRequiredScore()); break;