public static String webContextPath(final String first, final String... more) {
        if (more.length == 0 && (first == null || first.isEmpty())) {
            return "";
        }

        final StringBuilder b = new StringBuilder();
        if (first != null) {
            if (!first.startsWith("/")) {
                b.append('/');
            }
            b.append(first);
        }

        for (final String s : more) {
            if (s != null && !s.isEmpty()) {
                b.append('/');
                b.append(s);
            }
        }

        final String cleanedPath = cleanPath(b.toString());
        return cleanedPath.length() == 1 ? "" : cleanedPath;
    }
public static String webContextPath ( final String first , final String ... more ) { if ( more . length == 0 && ( first == null || first . isEmpty ( ) ) ) { return "" ; } final StringBuilder b = new StringBuilder ( ) ; if ( first != null ) { if ( ! first . startsWith ( "/" ) ) { b . append ( '/' ) ; } b . append ( first ) ; } for ( final String s : more ) { if ( s != null && ! s . isEmpty ( ) ) { b . append ( '/' ) ; b . append ( s ) ; } } final String cleanedPath = cleanPath ( b . toString ( ) ) ; return cleanedPath . length ( ) == 1 ? "" : cleanedPath ; }
Creates a web context path from components. Concatenates all path components
using '/' character as delimiter and the result is then:
<ol>
<li>prefixed with '/' character</li>
<li>stripped from all multiple consecutive occurrences of '/' characters</li>
<li>stripped from trailing '/' character(s)</li>
</ol>

@param components
web context path components
@return empty string or string which starts with a "/" character but does not
end with a "/" character