config-prettyfaces/src/main/java/com/ocpsoft/pretty/faces/util/URLDuplicatePathCanonicalizer.java
public String canonicalize(final String url)
    {
        if (url != null && url.contains("/../"))
        {
            StringBuffer result = new StringBuffer();
            Matcher m = pattern.matcher(url);
            while (m.find())
            {
                if (m.group(1).equals(m.group(2)))
                {
                    m.appendReplacement(result, m.group(1));
                }
                m.appendTail(result);
            }
            return result.toString();
        }
        return url;
    }
public String canonicalize(final String url)
    {
        if (url != null && url.contains("/../"))
        {
            StringBuffer result = new StringBuffer();
            Matcher m = pattern.matcher(url);
            while (m.find())
            {
                if (m.group(1).equals(m.group(2)))
                {
                    m.appendReplacement(result, m.group(1));
                }
                m.appendTail(result);
            }
            return result.toString();
        }
        return url;
    }
Canonicalize a given URL, replacing relative path structures with the
condensed path. (Eg. /xxxx/../xxxx/ => /xxxx/)

@return Return the canonicalized URL. If the URL requires no
canonicalization, return the original unmodified URL.