private void initMappingRegistry()

in restful/src/main/java/org/apache/shardingsphere/elasticjob/restful/pipeline/HttpRequestDispatcher.java [75:93]


    private void initMappingRegistry(final List<RestfulController> restfulControllers) {
        for (RestfulController restfulController : restfulControllers) {
            Class<? extends RestfulController> controllerClass = restfulController.getClass();
            String contextPath = Optional.ofNullable(controllerClass.getAnnotation(ContextPath.class)).map(ContextPath::value).orElse("");
            for (Method method : controllerClass.getMethods()) {
                Mapping mapping = method.getAnnotation(Mapping.class);
                if (null == mapping) {
                    continue;
                }
                HttpMethod httpMethod = HttpMethod.valueOf(mapping.method());
                String path = mapping.path();
                String fullPathPattern = resolveFullPath(contextPath, path);
                if (!trailingSlashSensitive) {
                    fullPathPattern = appendTrailingSlashIfAbsent(fullPathPattern);
                }
                mappingRegistry.addMapping(httpMethod, fullPathPattern, new Handler(restfulController, method));
            }
        }
    }