/** * Attaches a Restlet to this router as the default target to invoke when no * route matches. It actually sets a default route that scores all calls to * 1.0. * * @param defaultTarget * The Restlet to use as the default target. * @return The created route. */ public Route attachDefault(Restlet defaultTarget) { final Route result = createRoute("", defaultTarget); setDefaultRoute(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); } }