common/src/main/java/HTTPClient/Util.java
/**
     * Compares two http urls for equality. This exists because the method
     * <code>java.net.URL.sameFile()</code> is broken (an explicit port 80
     * doesn't compare equal to an implicit port, and it doesn't take
     * escapes into account).
     *
     * <P>Two http urls are considered equal if they have the same protocol
     * (case-insensitive match), the same host (case-insensitive), the
     * same port and the same file (after decoding escaped characters).
     *
     * @param url1 the first url
     * @param url1 the second url
     * @return true if <var>url1</var> and <var>url2</var> compare equal
     */
Compares two http urls for equality. This exists because the method
java.net.URL.sameFile() is broken (an explicit port 80
doesn't compare equal to an implicit port, and it doesn't take
escapes into account).

Two http urls are considered equal if they have the same protocol
(case-insensitive match), the same host (case-insensitive), the
same port and the same file (after decoding escaped characters).

@param url1 the first url
@param url1 the second url
@return true if url1 and url2 compare equal
Compares two http urls for equality . This exists because the method java . net . URL . sameFile () is broken ( an explicit port 80 doesn ' t compare equal to an implicit port and it doesn ' t take escapes into account ) . Two http urls are considered equal if they have the same protocol ( case - insensitive match ) the same host ( case - insensitive ) the same port and the same file ( after decoding escaped characters ) . @param url1 the first url @param url1 the second url @return true if url1 and url2 compare equal
public final static boolean sameHttpURL(URL url1, URL url2)
    {
	if (!url1.getProtocol().equalsIgnoreCase(url2.getProtocol()))
	    return false;
	if (!url1.getHost().equalsIgnoreCase(url2.getHost()))
	    return false;
	int port1 = url1.getPort(), port2 = url2.getPort();
	if (port1 == -1)  port1 = URI.defaultPort(url1.getProtocol());
	if (port2 == -1)  port2 = URI.defaultPort(url1.getProtocol());
	if (port1 != port2)
	    return false;
	try
	    { return URI.unescape(url1.getFile(), null).equals(URI.unescape(url2.getFile(), null)); }
	catch (ParseException pe)
	    { return url1.getFile().equals(url2.getFile());}
    }
public final static boolean sameHttpURL ( URL url1 , URL url2 ) { if ( ! url1 . getProtocol ( ) . equalsIgnoreCase ( url2 . getProtocol ( ) ) ) return false ; if ( ! url1 . getHost ( ) . equalsIgnoreCase ( url2 . getHost ( ) ) ) return false ; int port1 = url1 . getPort ( ) , port2 = url2 . getPort ( ) ; if ( port1 == - 1 ) port1 = URI . defaultPort ( url1 . getProtocol ( ) ) ; if ( port2 == - 1 ) port2 = URI . defaultPort ( url1 . getProtocol ( ) ) ; if ( port1 != port2 ) return false ; try { return URI . unescape ( url1 . getFile ( ) , null ) . equals ( URI . unescape ( url2 . getFile ( ) , null ) ) ; } catch ( ParseException pe ) { return url1 . getFile ( ) . equals ( url2 . getFile ( ) ) ; } }
Compares two http urls for equality.
Compares two http urls for equality .