@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 setDefaultLocation(RouteBuilder route, MApiParameterBuilder p) { if(null == p.getLocation()) { if (route.getPathTemplate().getTemplateVariables().contains(p.getName())) { p.setLocation(MApiParameter.Location.PATH); return true; } if(p.getType().isComplexType() || p.getType().isTypeRef() || p.getType().isDictionaryType()) { p.setLocation(MApiParameter.Location.BODY); return true; } p.setLocation(MApiParameter.Location.QUERY); 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);