drools-eclipse/org.guvnor.eclipse.webdav/src/client/org/eclipse/webdav/client/URLTool.java
public static URL getRoot(URL url) {
        try {
            return new URL(url.getProtocol(), url.getHost(), url.getPort(), "/"); //$NON-NLS-1$
        } catch (MalformedURLException e) {
            Assert.isTrue(false, Policy.bind("assert.internalError")); //$NON-NLS-1$
        }
        return null;
    }
public static URL getRoot(URL url) {
        try {
            return new URL(url.getProtocol(), url.getHost(), url.getPort(), "/"); //$NON-NLS-1$
        } catch (MalformedURLException e) {
            Assert.isTrue(false, Policy.bind("assert.internalError")); //$NON-NLS-1$
        }
        return null;
    }
public static URL getRoot ( URL url ) { try { return new URL ( url . getProtocol ( ) , url . getHost ( ) , url . getPort ( ) , "/" ) ; //$NON-NLS-1$ } catch ( MalformedURLException e ) { Assert . isTrue ( false , Policy . bind ( "assert.internalError" ) ) ; //$NON-NLS-1$ } return null ; }
Returns the root URL of the given URL.
<table>
<caption>Example</caption>
<tr>
<th>Given URL</th>
<th>Root URL</th>
<tr>
<td>"http://hostname/"</td>
<td>"http://hostname/"</td>
<tr>
<td>"http://hostname/folder/file</td>
<td>"http://hostname/"</td>
</table>

@param url a URL
@return    the root URL of the given URL
Returns the root URL of the given URL . <table > <caption > Example< / caption > <tr > <th > Given URL< / th > <th > Root URL< / th > <tr > <td > http : // hostname / < / td > <td > http : // hostname / < / td > <tr > <td > http : // hostname / folder / file< / td > <td > http : // hostname / < / td > < / table >