@Override public String getPath() { return template.getTemplate(); }
protected void resolveAppRoutes(App app, ApiConfigurator c) { String basePath = c.config().getBasePath(); for(Route route : app.routes()) { String pathTemplate = route.getPathTemplate().getTemplate(); if(pathTemplate.equals(basePath) || pathTemplate.startsWith(basePath)) { resolveResourceType(app, c, route); c.addRoute(route); } } }
@Override public boolean isOperationExists(RestdContext context, RouteBuilder r) { String verb = r.getMethod(); String path = r.getPathTemplate().getTemplate(); for(RequestMappingInfo mapping : allMappings.keySet()) { if(!isSamePath(mapping, path)) { continue; } if(isSameMethod(mapping, verb)) { apiMappings.add(mapping); Object handler = allMappings.get(mapping); String desc = handler.toString(); if(handler instanceof HandlerMethod) { HandlerMethod hm = (HandlerMethod)handler; desc = "spring:" + getHandlerDescription(hm); processHandlerMethod(r, hm); } r.setEnabled(true); r.setExecutable(false); r.setAction(new SpringAction(r.getAction(), desc)); return true; } } return false; }
protected boolean isOperationExists(RestdContext context, RouteBuilder route) { for(ApiRoute ar : context.getApiConfig().getApiRoutes()) { Route route1 = ar.getRoute(); if(route.getMethod().equalsIgnoreCase(route1.getMethod()) && route.getPathTemplate().getTemplate().equals(route1.getPathTemplate().getTemplate())) { route.setAction(route1.getAction()); route.setEnabled(false); return true; } } for(RestdOperationSupport support : operationSupports) { if(support.isOperationExists(context, route)) { if(null == route.getEnabled()) { route.setEnabled(false); } return route.isDisabledExplicitly(); } } return false; }
protected boolean doCheckOperationExists(RestdContext context, RouteBuilder r, Routes routes, boolean container) { final String verb = r.getMethod(); final String path = r.getPathTemplate().getTemplate(); final String fullPath = container ? path : Paths.suffixWithSlash(context.getApi().getBasePath()) + Paths.prefixWithoutSlash(path); if(route.getPathTemplate().getTemplate().equals(fullPath) && Strings.equalsIgnoreCase(route.getMethod(), verb)) { Action action = route.getAction(); if(action instanceof CombinedAction) {
protected void createApiPath(ApiMetadataContext context, ApiMetadataBuilder md, Route route) { PathTemplate pt = route.getPathTemplate(); String pathTemplate = Strings.removeStart(pt.getTemplate(), md.getBasePath()); if(!Strings.startsWith(pathTemplate,"/")){ pathTemplate = "/"+pathTemplate; } MApiPathBuilder path = md.getPath(pathTemplate); if(null == path) { path = new MApiPathBuilder(); path.setPathTemplate(pathTemplate); md.addPath(path); } log.debug("Path {} -> {} :", pt, route.getAction()); path.addOperation(createOperation(context, md, route)); }
Ignore ignore = route.getAction().searchAnnotation(Ignore.class); if(null != ignore && ignore.value()){ configurator.ignore(route.getPathTemplate().getTemplate()); if(Strings.startsWith(route.getPathTemplate().getTemplate(), prefix)) { log.debug("Set failure handler for path prefix '{}'", route.getPathTemplate()); spb(route).setFailureHandler(handler);