/** * Compare two URLs, excluding the "ref" fields. Returns <code>true</code> * if this <code>URL</code> and the <code>other</code> argument both refer * to the same resource. The two <code>URLs</code> might not both contain * the same anchor. */ public boolean sameFile(URL other) { if (!compare(protocol, other.getProtocol())) return (false); if (!compare(host, other.getHost())) return (false); if (port != other.getPort()) return (false); if (!compare(file, other.getFile())) return (false); return (true); }
/* */ private boolean hasScheme(String uri) /* */ { /* 1533 */ int len = uri.length(); /* 1534 */ for (int i = 0; i < len; i++) { /* 1535 */ char c = uri.charAt(i); /* 1536 */ if (c == ':') /* 1537 */ return i > 0; /* 1538 */ if (!URL.isSchemeChar(c)) { /* 1539 */ return false; /* */ } /* */ } /* 1542 */ return false; /* */ } /* */
/** * Compare two URLs for equality. The result is <code>true</code> if and * only if the argument is not null, and is a <code>URL</code> object * that represents the same <code>URL</code> as this object. Two * <code>URLs</code> are equal if they have the same protocol and * reference the same host, the same port number on the host, * and the same file and anchor on the host. * * @param obj The URL to compare against */ @Override public boolean equals(Object obj) { if (!(obj instanceof URL)) return (false); URL other = (URL) obj; if (!sameFile(other)) return (false); return (compare(ref, other.getRef())); }
} else if( c == '#' ) { aRef = true; } else if( !isSchemeChar((char)c) ) { break; newProtocol.equalsIgnoreCase(context.getProtocol()))) { if ((context.getPath() != null) && (context.getPath().startsWith("/"))) newProtocol = null; if (newProtocol == null) { protocol = context.getProtocol(); authority = context.getAuthority(); userInfo = context.getUserInfo(); host = context.getHost(); port = context.getPort(); file = context.getFile(); int question = file.lastIndexOf("?"); if (question < 0) parse(spec, start, limit); if (context != null) normalize();
url = new URL(location); } catch (MalformedURLException e) { return (false); if (!hreq.getScheme().equalsIgnoreCase(url.getProtocol())) return (false); if (!hreq.getServerName().equalsIgnoreCase(url.getHost())) return (false); int serverPort = hreq.getServerPort(); serverPort = 80; int urlPort = url.getPort(); if (urlPort == -1) { if ("https".equals(url.getProtocol())) urlPort = 443; else String file = url.getFile(); if ((file == null) || !file.startsWith(contextPath)) return (false);
} else if( c == '#' ) { aRef = true; } else if( !isSchemeChar((char)c) ) { break; newProtocol.equalsIgnoreCase(context.getProtocol()))) { if ((context.getPath() != null) && (context.getPath().startsWith("/"))) newProtocol = null; if (newProtocol == null) { protocol = context.getProtocol(); authority = context.getAuthority(); userInfo = context.getUserInfo(); host = context.getHost(); port = context.getPort(); file = context.getFile(); int question = file.lastIndexOf("?"); if (question < 0) parse(spec, start, limit); if (context != null) normalize();
url = new URL(location); } catch (MalformedURLException e) { return (false); if (!hreq.getScheme().equalsIgnoreCase(url.getProtocol())) return (false); if (!hreq.getServerName().equalsIgnoreCase(url.getHost())) return (false); int serverPort = hreq.getServerPort(); serverPort = 80; int urlPort = url.getPort(); if (urlPort == -1) { if ("https".equals(url.getProtocol())) urlPort = 443; else String file = url.getFile(); if ((file == null) || !file.startsWith(contextPath)) return (false);
} else if( c == '#' ) { aRef = true; } else if( !isSchemeChar((char)c) ) { break; newProtocol.equalsIgnoreCase(context.getProtocol()))) { if ((context.getPath() != null) && (context.getPath().startsWith("/"))) newProtocol = null; if (newProtocol == null) { protocol = context.getProtocol(); authority = context.getAuthority(); userInfo = context.getUserInfo(); host = context.getHost(); port = context.getPort(); file = context.getFile(); int question = file.lastIndexOf("?"); if (question < 0) parse(spec, start, limit); if (context != null) normalize();
/* 1406 */ url = new URL(location); /* */ } catch (MalformedURLException e) { /* 1408 */ return false; /* 1412 */ if (!hreq.getScheme().equalsIgnoreCase(url.getProtocol())) /* 1413 */ return false; /* 1414 */ if (!hreq.getServerName().equalsIgnoreCase(url.getHost())) /* 1415 */ return false; /* 1416 */ int serverPort = hreq.getServerPort(); /* 1421 */ serverPort = 80; /* 1423 */ int urlPort = url.getPort(); /* 1424 */ if (urlPort == -1) { /* 1425 */ if ("https".equals(url.getProtocol())) /* 1426 */ urlPort = 443; /* */ else /* 1435 */ String file = url.getFile(); /* 1436 */ if ((file == null) || (!file.startsWith(contextPath))) /* 1437 */ return false;
/** * Compare two URLs, excluding the "ref" fields. Returns <code>true</code> * if this <code>URL</code> and the <code>other</code> argument both refer * to the same resource. The two <code>URLs</code> might not both contain * the same anchor. */ public boolean sameFile(URL other) { if (!compare(protocol, other.getProtocol())) return (false); if (!compare(host, other.getHost())) return (false); if (port != other.getPort()) return (false); if (!compare(file, other.getFile())) return (false); return (true); }
/** * Compare two URLs for equality. The result is <code>true</code> if and * only if the argument is not null, and is a <code>URL</code> object * that represents the same <code>URL</code> as this object. Two * <code>URLs</code> are equal if they have the same protocol and * reference the same host, the same port number on the host, * and the same file and anchor on the host. * * @param obj The URL to compare against */ public boolean equals(Object obj) { if (obj == null) return (false); if (!(obj instanceof URL)) return (false); URL other = (URL) obj; if (!sameFile(other)) return (false); return (compare(ref, other.getRef())); }
/** * Determine if a URI string has a <code>scheme</code> component. */ private boolean hasScheme(String uri) { int len = uri.length(); for(int i=0; i < len ; i++) { char c = uri.charAt(i); if(c == ':') { return i > 0; } else if(!URL.isSchemeChar(c)) { return false; } } return false; }
} else if( c == '#' ) { aRef = true; } else if( !isSchemeChar((char)c) ) { break; newProtocol.equalsIgnoreCase(context.getProtocol()))) { if ((context.getPath() != null) && (context.getPath().startsWith("/"))) newProtocol = null; if (newProtocol == null) { protocol = context.getProtocol(); authority = context.getAuthority(); userInfo = context.getUserInfo(); host = context.getHost(); port = context.getPort(); file = context.getFile(); int question = file.lastIndexOf("?"); if (question < 0) parse(spec, start, limit); if (context != null) normalize();
url = new URL(location); } catch (MalformedURLException e) { return (false); if (!hreq.getScheme().equalsIgnoreCase(url.getProtocol())) return (false); if (!hreq.getServerName().equalsIgnoreCase(url.getHost())) return (false); int serverPort = hreq.getServerPort(); serverPort = 80; int urlPort = url.getPort(); if (urlPort == -1) { if ("https".equals(url.getProtocol())) urlPort = 443; else return (false); String file = url.getFile(); if (file == null) return (false);
/** * Compare two URLs, excluding the "ref" fields. Returns <code>true</code> * if this <code>URL</code> and the <code>other</code> argument both refer * to the same resource. The two <code>URLs</code> might not both contain * the same anchor. */ public boolean sameFile(URL other) { if (!compare(protocol, other.getProtocol())) return (false); if (!compare(host, other.getHost())) return (false); if (port != other.getPort()) return (false); if (!compare(file, other.getFile())) return (false); return (true); }
/** * Compare two URLs for equality. The result is <code>true</code> if and * only if the argument is not null, and is a <code>URL</code> object * that represents the same <code>URL</code> as this object. Two * <code>URLs</code> are equal if they have the same protocol and * reference the same host, the same port number on the host, * and the same file and anchor on the host. * * @param obj The URL to compare against */ @Override public boolean equals(Object obj) { if (!(obj instanceof URL)) return (false); URL other = (URL) obj; if (!sameFile(other)) return (false); return (compare(ref, other.getRef())); }
/** * Determine if a URI string has a <code>scheme</code> component. */ private boolean hasScheme(String uri) { int len = uri.length(); for(int i=0; i < len ; i++) { char c = uri.charAt(i); if(c == ':') { return i > 0; } else if(!URL.isSchemeChar(c)) { return false; } } return false; }
} else if( c == '#' ) { aRef = true; } else if( !isSchemeChar((char)c) ) { break; newProtocol.equalsIgnoreCase(context.getProtocol()))) { if ((context.getPath() != null) && (context.getPath().startsWith("/"))) newProtocol = null; if (newProtocol == null) { protocol = context.getProtocol(); authority = context.getAuthority(); userInfo = context.getUserInfo(); host = context.getHost(); port = context.getPort(); file = context.getFile(); int question = file.lastIndexOf("?"); if (question < 0) parse(spec, start, limit); if (context != null) normalize();
url = new URL(location); } catch (MalformedURLException e) { return (false); if (!hreq.getScheme().equalsIgnoreCase(url.getProtocol())) return (false); if (!hreq.getServerName().equalsIgnoreCase(url.getHost())) return (false); int serverPort = hreq.getServerPort(); serverPort = 80; int urlPort = url.getPort(); if (urlPort == -1) { if ("https".equals(url.getProtocol())) urlPort = 443; else String file = url.getFile(); if ((file == null) || !file.startsWith(contextPath)) return (false);
/** * Compare two URLs, excluding the "ref" fields. Returns <code>true</code> * if this <code>URL</code> and the <code>other</code> argument both refer * to the same resource. The two <code>URLs</code> might not both contain * the same anchor. */ public boolean sameFile(URL other) { if (!compare(protocol, other.getProtocol())) return (false); if (!compare(host, other.getHost())) return (false); if (port != other.getPort()) return (false); if (!compare(file, other.getFile())) return (false); return (true); }