/** * Inserting the keys from the parameter map only if the keys are defined, prevents thrashing * the existing persistent caches at rolling restart of high-traffic servers. * The cache keys of all URIs that don't set these parameters must not change. * * TODO: String parameters that have KEY_SEPARATOR appearing as a part of a string param need * to be escaped (e.g. with a backslash like so: ":" -> "\:") to prevent weird cache key * collisions. Moreover the active character (backslash) needs to be escaped itself for similar * reasons. */ public String build() { StringBuilder keyBuilder = new StringBuilder(2 * String.valueOf(legacyParams[0]).length()); appendLegacyKeys(keyBuilder); if (!paramMap.isEmpty()) { for (Map.Entry<String, Object> mapEntry : paramMap.entrySet()) { keyBuilder.append(KEY_SEPARATOR); keyBuilder.append(String.format("%s=%s", mapEntry.getKey(), mapEntry.getValue())); } } return keyBuilder.toString(); }
/** * Inserting the keys from the parameter map only if the keys are defined, prevents thrashing * the existing persistent caches at rolling restart of high-traffic servers. * The cache keys of all URIs that don't set these parameters must not change. * * TODO: String parameters that have KEY_SEPARATOR appearing as a part of a string param need * to be escaped (e.g. with a backslash like so: ":" -> "\:") to prevent weird cache key * collisions. Moreover the active character (backslash) needs to be escaped itself for similar * reasons. */ public String build() { StringBuilder keyBuilder = new StringBuilder(2 * String.valueOf(legacyParams[0]).length()); appendLegacyKeys(keyBuilder); if (!paramMap.isEmpty()) { for (Map.Entry<String, Object> mapEntry : paramMap.entrySet()) { keyBuilder.append(KEY_SEPARATOR); keyBuilder.append(String.format("%s=%s", mapEntry.getKey(), mapEntry.getValue())); } } return keyBuilder.toString(); }
/** * Inserting the keys from the parameter map only if the keys are defined, prevents thrashing * the existing persistent caches at rolling restart of high-traffic servers. * The cache keys of all URIs that don't set these parameters must not change. * * TODO: String parameters that have KEY_SEPARATOR appearing as a part of a string param need * to be escaped (e.g. with a backslash like so: ":" -> "\:") to prevent weird cache key * collisions. Moreover the active character (backslash) needs to be escaped itself for similar * reasons. */ public String build() { StringBuilder keyBuilder = new StringBuilder(2 * String.valueOf(legacyParams[0]).length()); appendLegacyKeys(keyBuilder); if (!paramMap.isEmpty()) { for (Map.Entry<String, Object> mapEntry : paramMap.entrySet()) { keyBuilder.append(KEY_SEPARATOR); keyBuilder.append(String.format("%s=%s", mapEntry.getKey(), mapEntry.getValue())); } } return keyBuilder.toString(); }