src/main/java/org/apache/sling/api/servlets/SlingJakartaSafeMethodsServlet.java [377:445]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        } else {

            throw new ServletException("Not a Sling HTTP request/response");
        }
    }

    /**
     * Returns the simple class name of this servlet class. Extensions of this
     * class may overwrite to return more specific information.
     */
    @Override
    public @NotNull String getServletInfo() {
        return getClass().getSimpleName();
    }

    /**
     * Helper method called by
     * {@link #doOptions(SlingJakartaHttpServletRequest, SlingJakartaHttpServletResponse)} to calculate
     * the value of the <em>Allow</em> header sent as the response to the HTTP
     * <em>OPTIONS</em> request.
     * <p>
     * This base class implementation checks whether any doXXX methods exist for
     * <em>GET</em> and <em>HEAD</em> and returns the list of methods
     * supported found. The list returned always includes the HTTP
     * <em>OPTIONS</em> and <em>TRACE</em> methods.
     * <p>
     * Implementations of this class may overwrite this method check for more
     * methods supported by the extension (generally the same list as used in
     * the {@link #mayService(SlingJakartaHttpServletRequest, SlingJakartaHttpServletResponse)} method).
     * This base class implementation should always be called to make sure the
     * default HTTP methods are included in the list.
     *
     * @param declaredMethods The public and protected methods declared in the
     *            extension of this class.
     * @return A <code>StringBuffer</code> containing the list of HTTP methods
     *         supported.
     */
    protected StringBuffer getAllowedRequestMethods(Map<String, Method> declaredMethods) {
        StringBuffer allowBuf = new StringBuffer();

        // OPTIONS and TRACE are always supported by this servlet
        allowBuf.append(HttpConstants.METHOD_OPTIONS);
        allowBuf.append(", ").append(HttpConstants.METHOD_TRACE);

        // add more method names depending on the methods found
        if (declaredMethods.containsKey("doHead") && !declaredMethods.containsKey("doGet")) {
            allowBuf.append(", ").append(HttpConstants.METHOD_HEAD);

        } else if (declaredMethods.containsKey("doGet")) {
            allowBuf.append(", ").append(HttpConstants.METHOD_GET);
            allowBuf.append(", ").append(HttpConstants.METHOD_HEAD);
        }

        return allowBuf;
    }

    /**
     * Returns a map of methods declared by the class indexed by method name.
     * This method is called by the
     * {@link #doOptions(SlingJakartaHttpServletRequest, SlingJakartaHttpServletResponse)} method to
     * find the methods to be checked by the
     * {@link #getAllowedRequestMethods(Map)} method. Note, that only extension
     * classes of this class are considered to be sure to not account for the
     * default implementations of the doXXX methods in this class.
     *
     * @param c The <code>Class</code> to get the declared methods from
     * @return The Map of methods considered for support checking.
     */
    private Map<String, Method> getAllDeclaredMethods(Class<?> c) {
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



src/main/java/org/apache/sling/api/servlets/SlingSafeMethodsServlet.java [371:439]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        } else {

            throw new ServletException("Not a Sling HTTP request/response");
        }
    }

    /**
     * Returns the simple class name of this servlet class. Extensions of this
     * class may overwrite to return more specific information.
     */
    @Override
    public @NotNull String getServletInfo() {
        return getClass().getSimpleName();
    }

    /**
     * Helper method called by
     * {@link #doOptions(SlingHttpServletRequest, SlingHttpServletResponse)} to calculate
     * the value of the <em>Allow</em> header sent as the response to the HTTP
     * <em>OPTIONS</em> request.
     * <p>
     * This base class implementation checks whether any doXXX methods exist for
     * <em>GET</em> and <em>HEAD</em> and returns the list of methods
     * supported found. The list returned always includes the HTTP
     * <em>OPTIONS</em> and <em>TRACE</em> methods.
     * <p>
     * Implementations of this class may overwrite this method check for more
     * methods supported by the extension (generally the same list as used in
     * the {@link #mayService(SlingHttpServletRequest, SlingHttpServletResponse)} method).
     * This base class implementation should always be called to make sure the
     * default HTTP methods are included in the list.
     *
     * @param declaredMethods The public and protected methods declared in the
     *            extension of this class.
     * @return A <code>StringBuffer</code> containing the list of HTTP methods
     *         supported.
     */
    protected StringBuffer getAllowedRequestMethods(Map<String, Method> declaredMethods) {
        StringBuffer allowBuf = new StringBuffer();

        // OPTIONS and TRACE are always supported by this servlet
        allowBuf.append(HttpConstants.METHOD_OPTIONS);
        allowBuf.append(", ").append(HttpConstants.METHOD_TRACE);

        // add more method names depending on the methods found
        if (declaredMethods.containsKey("doHead") && !declaredMethods.containsKey("doGet")) {
            allowBuf.append(", ").append(HttpConstants.METHOD_HEAD);

        } else if (declaredMethods.containsKey("doGet")) {
            allowBuf.append(", ").append(HttpConstants.METHOD_GET);
            allowBuf.append(", ").append(HttpConstants.METHOD_HEAD);
        }

        return allowBuf;
    }

    /**
     * Returns a map of methods declared by the class indexed by method name.
     * This method is called by the
     * {@link #doOptions(SlingHttpServletRequest, SlingHttpServletResponse)} method to
     * find the methods to be checked by the
     * {@link #getAllowedRequestMethods(Map)} method. Note, that only extension
     * classes of this class are considered to be sure to not account for the
     * default implementations of the doXXX methods in this class.
     *
     * @param c The <code>Class</code> to get the declared methods from
     * @return The Map of methods considered for support checking.
     */
    private Map<String, Method> getAllDeclaredMethods(Class<?> c) {
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



