public class GlideUrl extends java.lang.Object implements Key
Users wishing to replace the class for handling URLs must register a factory using GlideUrl.
To obtain a properly escaped URL, call toURL(). To obtain a properly escaped string
URL, call toStringUrl(). To obtain a less safe, but less expensive to calculate cache
key, call getCacheKey().
This class can also optionally wrap Headers for
convenience.
CHARSET, STRING_CHARSET_NAME| Constructor and Description |
|---|
GlideUrl(java.lang.String url) |
GlideUrl(java.lang.String url,
Headers headers) |
GlideUrl(java.net.URL url) |
GlideUrl(java.net.URL url,
Headers headers) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object o)
For caching to work correctly, implementations must implement this method and
Key.hashCode(). |
java.lang.String |
getCacheKey()
Returns an inexpensive to calculate
String suitable for use as a disk cache key. |
java.util.Map<java.lang.String,java.lang.String> |
getHeaders()
Returns a non-null
Map containing headers. |
int |
hashCode()
For caching to work correctly, implementations must implement this method and
Key.equals(Object). |
java.lang.String |
toString() |
java.lang.String |
toStringUrl()
Returns a properly escaped
String url that can be used to make http/https requests. |
java.net.URL |
toURL() |
void |
updateDiskCacheKey(java.security.MessageDigest messageDigest)
Adds all uniquely identifying information to the given digest.
|
public GlideUrl(java.net.URL url)
public GlideUrl(java.lang.String url)
public GlideUrl(java.net.URL url,
Headers headers)
public GlideUrl(java.lang.String url,
Headers headers)
public java.net.URL toURL()
throws java.net.MalformedURLException
java.net.MalformedURLExceptionpublic java.lang.String toStringUrl()
String url that can be used to make http/https requests.toURL(),
getCacheKey()public java.util.Map<java.lang.String,java.lang.String> getHeaders()
Map containing headers.public java.lang.String getCacheKey()
String suitable for use as a disk cache key.
This method does not include headers.
Unlike toStringUrl()} and toURL(), this method does not escape input.
public java.lang.String toString()
toString in class java.lang.Objectpublic void updateDiskCacheKey(@NonNull
java.security.MessageDigest messageDigest)
KeyNote - Using MessageDigest.reset() inside of this method will result
in undefined behavior.
updateDiskCacheKey in interface Keypublic boolean equals(java.lang.Object o)
KeyKey.hashCode().public int hashCode()
KeyKey.equals(Object).