Source:
<code>public static boolean rewriteURI(Node node) { boolean processed = false; if (node.getUri() != null && node.hasProperty(Constants.PROP_HTTP_URL_TEMPLATE)) { List<String> queryParameters = new ArrayList<String>(); String template = node.getProperties(Constants.PROP_HTTP_URL_TEMPLATE).iterator().next().getValue(); if (template != null && template.indexOf('?') != -1) { int index = template.indexOf('?'); String queryString = template.substring(index + 1); template = template.substring(0, index); StringTokenizer st = new StringTokenizer(queryString, "&"); while (st.hasMoreTokens()) { String token = st.nextToken(); if (token.charAt(0) == '{' && token.charAt(token.length() - 1) == '}') { queryParameters.add(token.substring(1, token.length() - 1)); } else { log.severe("Expecting query parameter template, e.g. {name}, but got '" + token + "'"); } } } StringTokenizer uriTokens = new StringTokenizer(node.getUri(), "/"); StringTokenizer templateTokens = new StringTokenizer(template, "/"); <START> if (uriTokens.countTokens() == templateTokens.countTokens()) { <END> Set<Property> props = null; while (uriTokens.hasMoreTokens()) { String uriToken = uriTokens.nextToken(); String templateToken = templateTokens.nextToken(); if (templateToken.charAt(0) == '{' && templateToken.charAt(templateToken.length() - 1) == '}') { String name = templateToken.substring(1, templateToken.length() - 1); if (props == null) { props = new HashSet<Property>(); } try { props.add(new Property(name, URLDecoder.decode(uriToken, "UTF-8"))); } catch (UnsupportedEncodingException e) { if (log.isLoggable(Level.FINEST)) { log.finest("Failed to decode value '" + uriToken + "': " + e); } } } else if (!uriToken.equals(templateToken)) { return false; } } if (props != null) { node.setUri(template); node.getProperties().addAll(props); processed = true; } if (rewriteURIQueryParameters(node, queryParameters)) { processed = true; } } } return processed; }</code><technical_language>I so. A quick check docs yield positive results, I remember this somewhere. I check later, I fine merge this case</technical_language>

Target:
public static boolean rewriteURI(Node node) { boolean processed = false; if (node.getUri() != null && node.hasProperty(Constants.PROP_HTTP_URL_TEMPLATE)) { List<String> queryParameters = new ArrayList<String>(); String template = node.getProperties(Constants.PROP_HTTP_URL_TEMPLATE).iterator().next().getValue(); if (template != null && template.indexOf('?') != -1) { int index = template.indexOf('?'); String queryString = template.substring(index + 1); template = template.substring(0, index); StringTokenizer st = new StringTokenizer(queryString, "&"); while (st.hasMoreTokens()) { String token = st.nextToken(); if (token.charAt(0) == '{' && token.charAt(token.length() - 1) == '}') { queryParameters.add(token.substring(1, token.length() - 1)); } else { log.severe("Expecting query parameter template, e.g. {name}, but got '" + token + "'"); } } } StringTokenizer uriTokens = new StringTokenizer(node.getUri(), "/"); StringTokenizer templateTokens = new StringTokenizer(template, "/"); if (uriTokens.countTokens() == templateTokens.countTokens()) { Set<Property> props = null; while (uriTokens.hasMoreTokens()) { String uriToken = uriTokens.nextToken(); String templateToken = templateTokens.nextToken(); if (templateToken.charAt(0) == '{' && templateToken.charAt(templateToken.length() - 1) == '}') { String name = templateToken.substring(1, templateToken.length() - 1); if (props == null) { props = new HashSet<Property>(); } try { props.add(new Property(URLDecoder.decode(name, "UTF-8"), URLDecoder.decode(uriToken, "UTF-8"))); } catch (UnsupportedEncodingException e) { if (log.isLoggable(Level.FINEST)) { log.finest("Failed to decode value '" + uriToken + "': " + e); } } } else if (!uriToken.equals(templateToken)) { return false; } } if (props != null) { node.setUri(template); node.getProperties().addAll(props); processed = true; } if (rewriteURIQueryParameters(node, queryParameters)) { processed = true; } } } return processed; }