urlFragment = urlFragment.substring(0, urlFragment.length() - 1);
}
if (urlFragment.length() == 0)
{
return new ValueMap(urlParameters != null ? urlParameters : Collections.EMPTY_MAP);
}
// Split into pairs
final String[] pairs = urlFragment.split("/");
// If we don't have an even number of pairs
if (pairs.length % 2 != 0)
{
log.warn("URL fragment has unmatched key/value pairs, responding with 404. Fragment: " +
urlFragment);
throw new AbortWithWebErrorCodeException(404);
}
// Loop through pairs
ValueMap parameters = new ValueMap();
for (int i = 0; i < pairs.length; i += 2)
{
String value = pairs[i + 1];
value = urlDecodePathComponent(value);
parameters.add(pairs[i], value);
}
if (urlParameters != null)
{
parameters.putAll(urlParameters);
}
return parameters;
}