MultiUriTemplateUtil { public static String removeMultiVariableValue( String requestPath, String matchingPatternPath, String variableName, String value, String valueSeparator){ Map<String, String> map = UriTemplateUtil.extractUriTemplateVariables(requestPath, matchingPatternPath); String oldValue = map.get(variableName); if (isNullOrEmpty(oldValue)){ String messagePattern = "the requestPath:[{}],matchingPatternPath:[{}],variableName:[{}],value is null or empty~~~"; LOGGER.debug(messagePattern, requestPath, matchingPatternPath, variableName); return requestPath; } List<String> list = toList(oldValue, valueSeparator); if (!list.contains(value)){ String messagePattern = "requestPath:[{}],matchingPatternPath:[{}],variableName:[{}],oldValue:[{}],not contains({})~~~"; LOGGER.debug(messagePattern, requestPath, matchingPatternPath, variableName, oldValue, value); return requestPath; } list.remove(value); map.put(variableName, toMutiValue(list, valueSeparator)); return UriTemplateUtil.expand(matchingPatternPath, map); } private  MultiUriTemplateUtil(); static String expandBestMatchingPatternMulti(HttpServletRequest request,String variableName,String value,String valueSeparator); static String expandWithMultiVariable(
                    String requestPath,
                    String matchingPatternPath,
                    String variableName,
                    String value,
                    String valueSeparator); static String expandWithMultiVariable(
                    String matchingPatternPath,
                    Map<String, String> map,
                    String variableName,
                    String value,
                    String valueSeparator); static String removeMultiVariableValue(
                    String requestPath,
                    String matchingPatternPath,
                    String variableName,
                    String value,
                    String valueSeparator);  }
@Test public void removeMultiVariableValue(){ String requestPath = "/s/c-m-c-s-k-s500,100,200,9000-o.htm"; String matchingPatternPath = "/s/c{categoryCode}-m{material}-c{color}-s{size}-k{kind}-s{style}-o{order}.htm"; String variableName = "style"; String value = "200"; String valueSeparator = ","; LOGGER.debug(MultiUriTemplateUtil.removeMultiVariableValue(requestPath, matchingPatternPath, variableName, value, valueSeparator)); }
@Test public void removeMultiVariableValue222(){ String requestPath = "/s/c-m-c-s-k-s-o.htm"; String matchingPatternPath = "/s/c{categoryCode}-m{material}-c{color}-s{size}-k{kind}-s{style}-o{order}.htm"; String variableName = "style"; String value = "200"; String valueSeparator = ","; LOGGER.debug(MultiUriTemplateUtil.removeMultiVariableValue(requestPath, matchingPatternPath, variableName, value, valueSeparator)); }
@Test public void removeMultiVariableValue2222(){ String requestPath = "/s/c-m-c-s-k-s500,100,200,9000-o.htm"; String matchingPatternPath = "/s/c{categoryCode}-m{material}-c{color}-s{size}-k{kind}-s{style}-o{order}.htm"; String variableName = "style"; String value = "20000"; String valueSeparator = ","; LOGGER.debug(MultiUriTemplateUtil.removeMultiVariableValue(requestPath, matchingPatternPath, variableName, value, valueSeparator)); }