com.tecnick.htmlutils.htmlurls
Class HTMLURLs

java.lang.Object
  extended by com.tecnick.htmlutils.htmlurls.HTMLURLs

public class HTMLURLs
extends java.lang.Object

Collection of static utility methods to manipulate URLs addresses on HTML documents.

Copyright (c) 2004-2005 Tecnick.com S.r.l (www.tecnick.com) Via Ugo Foscolo n.19 - 09045 Quartu Sant'Elena (CA) - ITALY - www.tecnick.com - info@tecnick.com
Project homepage: http://htmlurls.sourceforge.net
License: http://www.gnu.org/copyleft/lesser.html LGPL

Version:
1.0.004
Author:
Nicola Asuni [www.tecnick.com].

Constructor Summary
HTMLURLs()
          Void Constructor.
 
Method Summary
static boolean isRelativeLink(java.lang.String linktocheck)
          Check if the specified link is absolute or relative.
static java.lang.String resolveRelativeURL(java.lang.String urllink)
          Resolve combined relative links (e.g.: "/dir/subdir/../image.gif" became "/dir/image.gif")
static java.net.URL setURL(java.lang.String link)
          Creates a URL object from the String representation.
static java.net.URL setURL(java.lang.String document_base, java.lang.String link)
          Creates a URL object from the String representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HTMLURLs

public HTMLURLs()
Void Constructor.

Method Detail

isRelativeLink

public static boolean isRelativeLink(java.lang.String linktocheck)
Check if the specified link is absolute or relative.

Parameters:
linktocheck - link to check
Returns:
true if the link is relative, false otherwise

resolveRelativeURL

public static java.lang.String resolveRelativeURL(java.lang.String urllink)
Resolve combined relative links (e.g.: "/dir/subdir/../image.gif" became "/dir/image.gif")

Parameters:
urllink - link to resolve
Returns:
resolved URL

setURL

public static java.net.URL setURL(java.lang.String link)
Creates a URL object from the String representation.

Parameters:
link - link
Returns:
canonical URL from a relative specification or null in case of error

setURL

public static java.net.URL setURL(java.lang.String document_base,
                                  java.lang.String link)
Creates a URL object from the String representation.

Parameters:
document_base - base document path (e.g.: http://www.yoursite.com:8080)
link - link
Returns:
canonical URL from a relative specification or null in case of error