public static Map<String, String[]> getQueryMap(String query) {

        Map<String, String[]> map = new HashMap<>();
        String[] params = query.split(PARAM_CONCATENATE);
        for (String param : params) {
            String[] paramSplit = param.split("=");
            if (paramSplit.length == 0) {
                continue; // We found no key-/value-pair, so continue on the next param
            }
            String name = decodeQuery(paramSplit[0]);

            // hack for SOAP request (generally)
            if (name.trim().startsWith("<?")) { // $NON-NLS-1$
                map.put(" ", new String[] {query}); //blank name // $NON-NLS-1$
                return map;
            }

            // the post payload is not key=value
            if((param.startsWith("=") && paramSplit.length == 1) || paramSplit.length > 2) {
                map.put(" ", new String[] {query}); //blank name // $NON-NLS-1$
                return map;
            }

            String value = "";
            if(paramSplit.length>1) {
                value = decodeQuery(paramSplit[1]);
            }

            String[] known = map.get(name);
            if(known == null) {
                known = new String[] {value};
            }
            else {
                String[] tmp = new String[known.length+1];
                tmp[tmp.length-1] = value;
                System.arraycopy(known, 0, tmp, 0, known.length);
                known = tmp;
            }
            map.put(name, known);
        }
        return map;
    }
@Test
    void testGetQueryMapValueContainingAmpersand() {
        // see https://bz.apache.org/bugzilla/show_bug.cgi?id=58413
        String query = "login=toto1&pwd=Welcome%261";
        Map<String, String[]> params = RequestViewHTTP.getQueryMap(query);

        Assertions.assertNotNull(params);
        Assertions.assertEquals(2, params.size());

        String[] param1 = params.get("login");
        Assertions.assertNotNull(param1);
        Assertions.assertEquals(1, param1.length);
        Assertions.assertEquals("toto1", param1[0]);

        String[] param2 = params.get("pwd");
        Assertions.assertNotNull(param2);
        Assertions.assertEquals(1, param2.length);
        Assertions.assertEquals("Welcome&1", param2[0]);
    }