Package org.lobobrowser.util
Class Urls
- java.lang.Object
-
- org.lobobrowser.util.Urls
-
public class Urls extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static java.text.DateFormat
PATTERN_RFC1123
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.net.URL
createURL(java.net.URL baseUrl, java.lang.String relativeUrl)
Creates an absolute URL in a manner equivalent to major browsers.static java.lang.String
getCharset(java.net.URLConnection connection)
static java.lang.Long
getExpiration(java.net.URLConnection connection, long baseTime)
Returns the time when the document should be considered expired.static java.util.List
getHeaders(java.net.URLConnection connection)
static java.lang.String
getNoRefForm(java.net.URL url)
static java.net.URL
guessURL(java.lang.String spec)
static java.net.URL
guessURL(java.net.URL baseURL, java.lang.String spec)
static boolean
hasHost(java.net.URL url)
static boolean
isLocal(java.net.URL url)
Whether the URL refers to a resource in the local file system.static boolean
isLocalFile(java.net.URL url)
Whether the URL is a file in the local file system.static boolean
sameNoRefURL(java.net.URL url1, java.net.URL url2)
Comparison that does not consider Ref.
-
-
-
Method Detail
-
isLocal
public static boolean isLocal(java.net.URL url)
Whether the URL refers to a resource in the local file system.
-
isLocalFile
public static boolean isLocalFile(java.net.URL url)
Whether the URL is a file in the local file system.
-
hasHost
public static boolean hasHost(java.net.URL url)
-
createURL
public static java.net.URL createURL(java.net.URL baseUrl, java.lang.String relativeUrl) throws java.net.MalformedURLException
Creates an absolute URL in a manner equivalent to major browsers.- Throws:
java.net.MalformedURLException
-
getExpiration
public static java.lang.Long getExpiration(java.net.URLConnection connection, long baseTime)
Returns the time when the document should be considered expired. The time will be zero if the document always needs to be revalidated. It will benull
if no expiration time is specified.
-
getHeaders
public static java.util.List getHeaders(java.net.URLConnection connection)
-
guessURL
public static java.net.URL guessURL(java.net.URL baseURL, java.lang.String spec) throws java.net.MalformedURLException
- Throws:
java.net.MalformedURLException
-
guessURL
public static java.net.URL guessURL(java.lang.String spec) throws java.net.MalformedURLException
- Throws:
java.net.MalformedURLException
-
getCharset
public static java.lang.String getCharset(java.net.URLConnection connection)
-
getNoRefForm
public static java.lang.String getNoRefForm(java.net.URL url)
-
sameNoRefURL
public static boolean sameNoRefURL(java.net.URL url1, java.net.URL url2)
Comparison that does not consider Ref.- Parameters:
url1
-url2
-
-
-