@Test public void skipPairWithTwoEqualSign() { final String header = "key1=value1=subvalue1,key2=value2"; final Map<String, String> context = UNIT.parse(header); assertThat(context, hasEntry("key2", "value2")); assertThat(context.size(), is(1)); }
Map<String, String> parse(String serialized) { final StringTokenizer pairTokenizer = new StringTokenizer(serialized.trim(), ","); final Map<String, String> context = new HashMap<>(); while (pairTokenizer.hasMoreTokens()) { final String pairStr = pairTokenizer.nextToken(); final String[] keyValuePair = pairStr.split("="); if (keyValuePair.length != 2) { continue; } try { final String key = URLDecoder.decode(keyValuePair[0], ENCODING_CHARSET); final String value = URLDecoder.decode(keyValuePair[1], ENCODING_CHARSET); context.put(key, value); } catch (UnsupportedEncodingException e) { LOGGER.error("Charset not found", e); } } return context; }
HttpHeaderTransport { Map<String, String> parse(String serialized) { final StringTokenizer pairTokenizer = new StringTokenizer(serialized.trim(), ","); final Map<String, String> context = new HashMap<>(); while (pairTokenizer.hasMoreTokens()) { final String pairStr = pairTokenizer.nextToken(); final String[] keyValuePair = pairStr.split("="); if (keyValuePair.length != 2) { continue; } try { final String key = URLDecoder.decode(keyValuePair[0], ENCODING_CHARSET); final String value = URLDecoder.decode(keyValuePair[1], ENCODING_CHARSET); context.put(key, value); } catch (UnsupportedEncodingException e) { LOGGER.error("Charset not found", e); } } return context; } }
HttpHeaderTransport { Map<String, String> parse(String serialized) { final StringTokenizer pairTokenizer = new StringTokenizer(serialized.trim(), ","); final Map<String, String> context = new HashMap<>(); while (pairTokenizer.hasMoreTokens()) { final String pairStr = pairTokenizer.nextToken(); final String[] keyValuePair = pairStr.split("="); if (keyValuePair.length != 2) { continue; } try { final String key = URLDecoder.decode(keyValuePair[0], ENCODING_CHARSET); final String value = URLDecoder.decode(keyValuePair[1], ENCODING_CHARSET); context.put(key, value); } catch (UnsupportedEncodingException e) { LOGGER.error("Charset not found", e); } } return context; }  }
HttpHeaderTransport { Map<String, String> parse(String serialized) { final StringTokenizer pairTokenizer = new StringTokenizer(serialized.trim(), ","); final Map<String, String> context = new HashMap<>(); while (pairTokenizer.hasMoreTokens()) { final String pairStr = pairTokenizer.nextToken(); final String[] keyValuePair = pairStr.split("="); if (keyValuePair.length != 2) { continue; } try { final String key = URLDecoder.decode(keyValuePair[0], ENCODING_CHARSET); final String value = URLDecoder.decode(keyValuePair[1], ENCODING_CHARSET); context.put(key, value); } catch (UnsupportedEncodingException e) { LOGGER.error("Charset not found", e); } } return context; }  Map<String, String> parse(List<String> serializedElements); String render(Map<String, String> context); }
HttpHeaderTransport { Map<String, String> parse(String serialized) { final StringTokenizer pairTokenizer = new StringTokenizer(serialized.trim(), ","); final Map<String, String> context = new HashMap<>(); while (pairTokenizer.hasMoreTokens()) { final String pairStr = pairTokenizer.nextToken(); final String[] keyValuePair = pairStr.split("="); if (keyValuePair.length != 2) { continue; } try { final String key = URLDecoder.decode(keyValuePair[0], ENCODING_CHARSET); final String value = URLDecoder.decode(keyValuePair[1], ENCODING_CHARSET); context.put(key, value); } catch (UnsupportedEncodingException e) { LOGGER.error("Charset not found", e); } } return context; }  Map<String, String> parse(List<String> serializedElements); String render(Map<String, String> context); static final String ENCODING_CHARSET; }