drools-eclipse/org.guvnor.eclipse.webdav/src/client/org/eclipse/webdav/client/URLTool.java
public static boolean urlsOverlap(URL url1, URL url2) {
        if (!getRoot(url1).equals(getRoot(url2))) {
            return false;
        }
        Vector elements1 = URLTool.getElements(url1);
        Vector elements2 = URLTool.getElements(url2);
        for (int i = 0; i < elements1.size() && i < elements2.size(); ++i) {
            String element1 = (String) elements1.elementAt(i);
            String element2 = (String) elements2.elementAt(i);
            if (!element1.equals(element2)) {
                return false;
            }
        }
        return true;
    }
public static boolean urlsOverlap(URL url1, URL url2) {
        if (!getRoot(url1).equals(getRoot(url2))) {
            return false;
        }
        Vector elements1 = URLTool.getElements(url1);
        Vector elements2 = URLTool.getElements(url2);
        for (int i = 0; i < elements1.size() && i < elements2.size(); ++i) {
            String element1 = (String) elements1.elementAt(i);
            String element2 = (String) elements2.elementAt(i);
            if (!element1.equals(element2)) {
                return false;
            }
        }
        return true;
    }
public static boolean urlsOverlap ( URL url1 , URL url2 ) { if ( ! getRoot ( url1 ) . equals ( getRoot ( url2 ) ) ) { return false ; } Vector elements1 = URLTool . getElements ( url1 ) ; Vector elements2 = URLTool . getElements ( url2 ) ; for ( int i = 0 ; i < elements1 . size ( ) && i < elements2 . size ( ) ; ++ i ) { String element1 = ( String ) elements1 . elementAt ( i ) ; String element2 = ( String ) elements2 . elementAt ( i ) ; if ( ! element1 . equals ( element2 ) ) { return false ; } } return true ; }
Returns a boolean indicating whether the given URLs overlap.
<table>
<caption>Example</caption>
<tr>
<th>First URL</th>
<th>Second URL</th>
<th>Do they overlap</th>
<tr>
<td>"http://hostname/folder/"</td>
<td>"http://hostname/folder/"</td>
<td>true</td>
<tr>
<td>"http://hostname/folder/"</td>
<td>"http://hostname/folder/file"</td>
<td>true</td>
<tr>
<td>"http://hostname/folder/file"</td>
<td>"http://hostname/folder/"</td>
<td>true</td>
<tr>
<td>"http://hostname/folder1/"</td>
<td>"http://hostname/folder2/"</td>
<td>false</td>
<tr>
<td>"http://hostname1/folder/"</td>
<td>"http://hostname2/folder/"</td>
<td>false</td>
</table>
@param  url1 firt URL
@param  url2 second URL
@return a boolean indicating whether the given URLs overlap
Returns a boolean indicating whether the given URLs overlap . <table > <caption > Example< / caption > <tr > <th > First URL< / th > <th > Second URL< / th > <th > Do they overlap< / th > <tr > <td > http : // hostname / folder / < / td > <td > http : // hostname / folder / < / td > <td > true< / td > <tr > <td > http : // hostname / folder / < / td > <td > http : // hostname / folder / file < / td > <td > true< / td > <tr > <td > http : // hostname / folder / file < / td > <td > http : // hostname / folder / < / td > <td > true< / td > <tr > <td > http : // hostname / folder1 / < / td > <td > http : // hostname / folder2 / < / td > <td > false< / td > <tr > <td > http : // hostname1 / folder / < / td > <td > http : // hostname2 / folder / < / td > <td > false< / td > < / table >