|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.metamatrix.common.protocol.URLHelper
public class URLHelper
Helper class to build the URL objects from the strings. Since as an application we do not know if we are embedded or we are in our own server, we can not install the "URLStreamHandlers" in the VM, as they can be only installed once per VM, as an alternative, the stream handler must be specified at the time URL it is constructed. This class will help us to this code at one place. Here inspect the given string and build the correct type of URL with correct handler.
Constructor Summary | |
---|---|
URLHelper()
|
Method Summary | |
---|---|
static java.net.URL |
buildURL(java.lang.String url)
Construct the URL based on the String |
static java.net.URL |
buildURL(java.net.URL url)
|
static java.net.URL |
buildURL(java.net.URL context,
java.lang.String url)
|
static java.io.File |
createFileFromUrl(java.net.URL url,
java.lang.String fileNamePrefix,
java.lang.String fileNameSuffix)
Build a File from a URL object. |
static java.io.File |
createFileFromUrl(java.net.URL url,
java.lang.String filePath,
java.lang.String userName,
java.lang.String password,
boolean verifyHostname)
Download the content from the given URL and save it into the specified file. |
static boolean |
resolveUrl(java.net.URL url)
Determines whether a URL object resolves to a valid url. |
static boolean |
resolveUrl(java.net.URL url,
boolean verifyHostname)
Determines whether a URL object resolves to a valid url. |
static boolean |
resolveUrl(java.net.URL url,
java.lang.String userName,
java.lang.String password,
boolean verifyHostname)
Determines whether a URL object resolves to a valid url. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public URLHelper()
Method Detail |
---|
public static java.net.URL buildURL(java.lang.String url) throws java.net.MalformedURLException
url
-
java.net.MalformedURLException
public static java.net.URL buildURL(java.net.URL context, java.lang.String url) throws java.net.MalformedURLException
java.net.MalformedURLException
public static java.net.URL buildURL(java.net.URL url)
public static boolean resolveUrl(java.net.URL url, java.lang.String userName, java.lang.String password, boolean verifyHostname) throws java.net.MalformedURLException, java.io.IOException
url
- userName
- password
- verifyHostname
- whether to verify hostname for HTTPS connection
MalformedURLException,
- IOException
java.net.MalformedURLException
java.io.IOException
public static boolean resolveUrl(java.net.URL url) throws java.net.MalformedURLException, java.io.IOException
url
-
MalformedURLException,
- IOException
java.net.MalformedURLException
java.io.IOException
public static boolean resolveUrl(java.net.URL url, boolean verifyHostname) throws java.net.MalformedURLException, java.io.IOException
url
- verifyHostname
- whether to verify hostname for HTTPS connection
MalformedURLException,
- IOException
java.net.MalformedURLException
java.io.IOException
public static java.io.File createFileFromUrl(java.net.URL url, java.lang.String filePath, java.lang.String userName, java.lang.String password, boolean verifyHostname) throws java.net.MalformedURLException, java.io.IOException
url
- URL of the file to be savedfilePath
- the full path of the file nameuserName
- user name if authentication is requiredpassword
- password if authentication is requiredverifyHostname
- whether to verify hostname for HTTPS connection
java.net.MalformedURLException
java.io.IOException
public static java.io.File createFileFromUrl(java.net.URL url, java.lang.String fileNamePrefix, java.lang.String fileNameSuffix) throws java.net.MalformedURLException, java.io.IOException
File
from a URL
object.
url
- fileNamePrefix
- fileNameSuffix
-
java.net.MalformedURLException
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |