I'm trying to understand the logic of the parseQuery() method in Prometheus
HTTP Server (implemented in Java).

protected static Set<String> parseQuery(String query) throws IOException {
        Set<String> names = new HashSet<String>();
        if (query != null) {
            String[] pairs = query.split("&");
            for (String pair : pairs) {
                int idx = pair.indexOf("=");
                if (idx != -1 && URLDecoder.decode(pair.substring(0,
idx), "UTF-8").equals("name[]")) {
                    names.add(URLDecoder.decode(pair.substring(idx +
1), "UTF-8"));
                }
            }
        }

            return names;

    }

Can somebody explain what is the logic behind checking whether the
decoded URL sub string is equal to name[] ?

Regards

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/CAKHONj1oSTKYHj_FeNxfwK7MBXuo87hMv0Mjc59HDQHC4kwtPA%40mail.gmail.com.

Reply via email to