private boolean accept()

in src/main/java/org/apache/sling/servlets/resolver/internal/PathBasedServletAcceptor.java [84:114]


    private boolean accept(String servletName, SlingServletConfig config, String servicePropertyKey, boolean emptyValueApplies, String ... requestValues) {
        final String [] propValues = toStringArray(config.getServiceProperty(servicePropertyKey));
        if(propValues.length == 0) {
            LOGGER.debug("Property {} is null or empty, not checking that value for {}", servicePropertyKey, servletName);
            return true;
        }

        boolean accepted = false;
        if(propValues.length == 1 && EMPTY_VALUE.equals(propValues[0])) {
            // If supported for this service property, request value must be empty
            if(!emptyValueApplies) {
                throw new InvalidPropertyException("Special value " + EMPTY_VALUE
                + "  is not valid for the " + servicePropertyKey + " service property");
            } else {
                accepted = requestValues.length == 0 || (requestValues.length == 1 && requestValues[0] == null);
            }
        } else {
            // requestValues must match at least one value in propValue
            for(String rValue : requestValues) {
                for(String pValue : propValues) {
                    if(rValue != null && rValue.equals(pValue)) {
                        accepted = true;
                        break;
                    }
                }
            }
        }

        LOGGER.debug("accepted={} for property {} and servlet {}", accepted, servicePropertyKey, servletName);
        return accepted;
    }