private void addByPath()

in src/main/java/org/apache/sling/servlets/resolver/internal/resource/ServletResourceProviderFactory.java [213:233]


    private void addByPath(Set<String> pathSet, ServiceReference<Servlet> ref) {
        String[] paths = PropertiesUtil.toStringArray(ref.getProperty(SLING_SERVLET_PATHS));
        if (paths != null && paths.length > 0) {
            for (String path : paths) {
                if (!path.startsWith("/")) {
                    path = getPrefix(ref).concat(path);
                }

                // add the unmodified path
                pathSet.add(path);

                String[] types = PropertiesUtil.toStringArray(ref.getProperty(SLING_SERVLET_RESOURCE_TYPES));

                if ((types == null || types.length == 0) || StringUtils.isEmpty(FilenameUtils.getExtension(path))) {
                    // ensure we have another entry which has the .servlet ext. if there wasn't one to begin with
                    // Radu says: this will make sure that scripts are equal to servlets in the resolution process
                    pathSet.add(ensureServletNameExtension(path));
                }
            }
        }
    }