|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.matalon.pagerankhits.util.UrlUtil
This class includes basic URL related utilities.
Field Summary | |
private static java.lang.String |
DEFAULT_PROTOCOL
|
private static java.lang.String |
FULL_DEFAULT_PROTOCOL
|
private static java.lang.String |
PROTOCOL_IDENTIFIER
|
private static java.util.Collection |
tlds
|
private static java.util.Collection |
validWebPageExtensions
|
Constructor Summary | |
UrlUtil()
|
Method Summary | |
private static void |
addLink(java.util.List links,
java.lang.String url,
java.lang.String parentUrl)
Adds the given URL to the given links list; if the URL is relative it shall be constructed using the given parent URL. |
private static java.net.URL |
createNewURL(java.lang.String address)
Creates a new URL object using the given address . |
static java.lang.Object[] |
extractTitleAndLinks(java.lang.String webPageAddress)
Extracts the title and the links of/inside the web page, having the given address. |
static java.lang.String |
getPageTitle(java.net.URL url)
|
private static java.lang.String |
getParentDirectory(java.lang.String fileOrPath)
|
static boolean |
isValidWebPageAddress(java.lang.String address,
boolean validateSyntax,
boolean validateExistance)
Checks if the given address is a valid web page address. |
static boolean |
isValidWebPageAddress(java.lang.String address,
java.lang.String parentAddress,
boolean validateSyntax,
boolean validateExistance)
Checks if the given address is a valid web page address. |
static java.lang.String |
normalizeUrl(java.lang.String url)
Converts the given url into an absolute valid address. |
static java.lang.String |
normalizeUrl(java.lang.String url,
java.lang.String parentUrl)
Converts the given url into an absolute valid address. |
static boolean |
validateUrl(java.lang.String url,
boolean validateSyntax,
boolean validateExistance)
Checks if the given url is syntactically valid and/or exists. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final java.lang.String DEFAULT_PROTOCOL
private static final java.lang.String PROTOCOL_IDENTIFIER
private static final java.lang.String FULL_DEFAULT_PROTOCOL
private static final java.util.Collection validWebPageExtensions
private static final java.util.Collection tlds
Constructor Detail |
public UrlUtil()
Method Detail |
public static final boolean validateUrl(java.lang.String url, boolean validateSyntax, boolean validateExistance)
url
is syntactically valid and/or exists.
url
- validateSyntax
- validateExistance
-
url
is syntactically valid, false otherwise.public static final boolean isValidWebPageAddress(java.lang.String address, boolean validateSyntax, boolean validateExistance)
address
is a valid web page address. (I.e. also a valid
URL and also an address of a web page (unlike image, pdf etc)).
address
- validateSyntax
- validateExistance
-
address
is a valid web page address, false otherwise.public static final boolean isValidWebPageAddress(java.lang.String address, java.lang.String parentAddress, boolean validateSyntax, boolean validateExistance)
address
is a valid web page address. (I.e. also a valid
URL and also an address of a web page (unlike image, pdf etc)).
address
- parentAddress
- validateSyntax
- validateExistance
-
address
is a valid web page address, false otherwise.public static final java.lang.String normalizeUrl(java.lang.String url)
url
into an absolute valid address.
url
-
url
is a valid relative/absolute
URL, null otherwise.public static final java.lang.String normalizeUrl(java.lang.String url, java.lang.String parentUrl)
url
into an absolute valid address. In case that the
given url
is relative, the method uses the given parent URL in order to
deduce the absolute representation of the URL.
url
- parentUrl
-
url
is a valid relative/absolute
URL, null otherwise.public static final java.lang.Object[] extractTitleAndLinks(java.lang.String webPageAddress)
webPageAddress
-
private static void addLink(java.util.List links, java.lang.String url, java.lang.String parentUrl)
links
- url
- parentUrl
- public static final java.lang.String getPageTitle(java.net.URL url)
url
-
private static final java.net.URL createNewURL(java.lang.String address)
address
.
address
-
private static final java.lang.String getParentDirectory(java.lang.String fileOrPath)
fileOrPath
-
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |