@Test public void testParseRFC2617() { final String expectedFormat = "Signature keyId=\"unit\",algorithm=\"hmac-sha1\",headers=\"Content-Type Date\",signature=\"yIy5ujWnGZ0pKVR7vY6Qv08WfLE=\""; final String legacyFormat = "Signature keyId=\"unit\", algorithm=\"hmac-sha1\", headers=\"Content-Type Date\", signature=\"yIy5ujWnGZ0pKVR7vY6Qv08WfLE=\""; Map<String, String> params = new LinkedHashMap<String, String>(); params.put("keyId", "unit"); params.put("algorithm", "hmac-sha1"); params.put("headers", "Content-Type Date"); params.put("signature", "yIy5ujWnGZ0pKVR7vY6Qv08WfLE="); Map<String, String> parsedExpected = Constants.parseRFC2617(expectedFormat); for (Map.Entry<String, String> entry : params.entrySet()) { assertEquals("parsed param values should be the same", entry.getValue(), parsedExpected.get(entry.getKey())); } Map<String, String> parsedLegacy = Constants.parseRFC2617(legacyFormat); for (Map.Entry<String, String> entry : params.entrySet()) { assertEquals("parsed param values should be the same", entry.getValue(), parsedLegacy.get(entry.getKey())); } }
public static Map<String, String> parseRFC2617(String header) { Map<String, String> params = new HashMap<String, String>(); if (header != null && header.toLowerCase().startsWith(Constants.SCHEME.toLowerCase())) { final Matcher matcher = RFC2617_PARAM.matcher(header.substring(Constants.SCHEME.length() + 1)); while (matcher.find()) { params.put(matcher.group(1), matcher.group(2)); } } return Collections.unmodifiableMap(params); }
Constants { public static Map<String, String> parseRFC2617(String header) { Map<String, String> params = new HashMap<String, String>(); if (header != null && header.toLowerCase().startsWith(Constants.SCHEME.toLowerCase())) { final Matcher matcher = RFC2617_PARAM.matcher(header.substring(Constants.SCHEME.length() + 1)); while (matcher.find()) { params.put(matcher.group(1), matcher.group(2)); } } return Collections.unmodifiableMap(params); } }
Constants { public static Map<String, String> parseRFC2617(String header) { Map<String, String> params = new HashMap<String, String>(); if (header != null && header.toLowerCase().startsWith(Constants.SCHEME.toLowerCase())) { final Matcher matcher = RFC2617_PARAM.matcher(header.substring(Constants.SCHEME.length() + 1)); while (matcher.find()) { params.put(matcher.group(1), matcher.group(2)); } } return Collections.unmodifiableMap(params); } private  Constants(); }
Constants { public static Map<String, String> parseRFC2617(String header) { Map<String, String> params = new HashMap<String, String>(); if (header != null && header.toLowerCase().startsWith(Constants.SCHEME.toLowerCase())) { final Matcher matcher = RFC2617_PARAM.matcher(header.substring(Constants.SCHEME.length() + 1)); while (matcher.find()) { params.put(matcher.group(1), matcher.group(2)); } } return Collections.unmodifiableMap(params); } private  Constants(); static List<String> parseTokens(String tokens); static String constructTokensString(List<String> tokens); static Map<String, String> parseRFC2617(String header); static String constructRFC2617(Map<String, String> params); static List<String> filterHeaders(List<String> headers); }
Constants { public static Map<String, String> parseRFC2617(String header) { Map<String, String> params = new HashMap<String, String>(); if (header != null && header.toLowerCase().startsWith(Constants.SCHEME.toLowerCase())) { final Matcher matcher = RFC2617_PARAM.matcher(header.substring(Constants.SCHEME.length() + 1)); while (matcher.find()) { params.put(matcher.group(1), matcher.group(2)); } } return Collections.unmodifiableMap(params); } private  Constants(); static List<String> parseTokens(String tokens); static String constructTokensString(List<String> tokens); static Map<String, String> parseRFC2617(String header); static String constructRFC2617(Map<String, String> params); static List<String> filterHeaders(List<String> headers); static final String SCHEME; static final String CHALLENGE; static final String REALM; static final String KEY_ID; @Deprecated
    static final String HEADER_REQUEST_LINE; static final String HEADER_REQUEST_TARGET; static final String HEADER_DATE; static final List<String> DEFAULT_HEADERS; static final List<String> IGNORE_HEADERS; static final String AUTHORIZATION; static final String HEADERS; static final String SIGNATURE; static final String ALGORITHMS; static final String ALGORITHM; static final Charset CHARSET; static final Pattern RFC2617_PARAM; static final KeyId DEFAULT_KEY_IDENTIFIER; static final Collection<Algorithm> ALL_SUPPORTED_ALGORITHMS; static final Challenge PREEMPTIVE_CHALLENGE; }