Resource implementation for java.net.URL locators.
Supports resolution as a URL and also as a File in
case of the "file:" protocol.
java.net.URL
| Modifier and Type | Field and Description |
|---|---|
| private static final String | |
| private volatile String | cleanedUrl
Cleaned URL String (with normalized path), used for comparisons. |
| private final URI | uri
Original URI, if available; used for URI and File access. |
| private final URL | url
Original URL, used for actual access. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public | |
| public | UrlResource(String
the URL protocol to use (e.g. "jar" or "file" - without colon);
also known as "scheme" protocol, String the location (e.g. the file path within that protocol);
also known as "scheme-specific part" location)Create a new |
| public | UrlResource(String
the URL protocol to use (e.g. "jar" or "file" - without colon);
also known as "scheme" protocol, String the location (e.g. the file path within that protocol);
also known as "scheme-specific part" location, String the fragment within that location (e.g. anchor on an HTML page,
as following after a "#" separator) fragment)Create a new |
| Modifier and Type | Method and Description |
|---|---|
| public Resource | createRelative(String
the relative path (relative to this resource) relativePath)Overrides org. Implements org. UrlResource, delegating to
createRelativeURL(String) for adapting the relative path.
|
| protected URL | createRelativeURL(String relativePath)
This delegate creates a |
| protected void | customizeConnection(URLConnection
the URLConnection to customize con)Overrides org. URLConnection before fetching the resource.
|
| public boolean | equals(Object
the reference object with which to compare. other)Overrides org. |
| public static UrlResource | |
| public static UrlResource | |
| private String | |
| public String | getDescription()
Implements org. |
| public File | getFile()
Overrides org. Implements org. |
| public String | getFilename()
Overrides org. Implements org. |
| public InputStream | getInputStream()
Implements org. |
| public URI | getURI()
Overrides org. Implements org. |
| public URL | getURL()
Overrides org. Implements org. |
| public int | hashCode()
Overrides org. |
| public boolean | isFile()
Overrides org. Overrides default org. false.
|
| AUTHORIZATION | back to summary |
|---|---|
| private static final String AUTHORIZATION | |
| cleanedUrl | back to summary |
|---|---|
| private volatile String cleanedUrl Cleaned URL String (with normalized path), used for comparisons. | |
| uri | back to summary |
|---|---|
| private final URI uri Original URI, if available; used for URI and File access. | |
| url | back to summary |
|---|---|
| private final URL url Original URL, used for actual access. | |
| UrlResource | back to summary |
|---|---|
| public UrlResource(URL url) Create a new
| |
| UrlResource | back to summary |
|---|---|
| public UrlResource(URI uri) throws MalformedURLException Create a new
| |
| UrlResource | back to summary |
|---|---|
| public UrlResource(String path) throws MalformedURLException Create a new Note The given path needs to be pre-encoded if necessary.
| |
| UrlResource | back to summary |
|---|---|
| public UrlResource(String protocol, String location) throws MalformedURLException Create a new The given parts will automatically get encoded if necessary.
| |
| UrlResource | back to summary |
|---|---|
| public UrlResource(String protocol, String location, String fragment) throws MalformedURLException Create a new The given parts will automatically get encoded if necessary.
| |
| createRelative | back to summary |
|---|---|
| public Resource createRelative(String relativePath) throws MalformedURLException Overrides org. Implements org. This implementation creates a
| |
| createRelativeURL | back to summary |
|---|---|
| protected URL createRelativeURL(String relativePath) throws MalformedURLException This delegate creates a
| |
| customizeConnection | back to summary |
|---|---|
| protected void customizeConnection(URLConnection con) throws IOException Overrides org. Doc from org. Customize the given Calls
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object other) Overrides org. This implementation compares the underlying URL references.
| |
| from | back to summary |
|---|---|
| public static UrlResource from(URI uri) throws UncheckedIOException Create a new This factory method is a convenience for
| |
| from | back to summary |
|---|---|
| public static UrlResource from(String path) throws UncheckedIOException Create a new This factory method is a convenience for
| |
| getCleanedUrl | back to summary |
|---|---|
| private String getCleanedUrl() Lazily determine a cleaned URL for the given original URL. | |
| getDescription | back to summary |
|---|---|
| public String getDescription() Implements org. This implementation returns a description that includes the URL.
| |
| getFile | back to summary |
|---|---|
| public File getFile() throws IOException Overrides org. Implements org. This implementation returns a File reference for the underlying URL/URI, provided that it refers to a file in the file system.
| |
| getFilename | back to summary |
|---|---|
| public String getFilename() Overrides org. Implements org. This implementation returns the URL-decoded name of the file that this URL refers to.
| |
| getInputStream | back to summary |
|---|---|
| public InputStream getInputStream() throws IOException Implements org. This implementation opens an InputStream for the given URL. It sets the
| |
| getURI | back to summary |
|---|---|
| public URI getURI() throws IOException Overrides org. Implements org. This implementation returns the underlying URI directly, if possible.
| |
| getURL | back to summary |
|---|---|
| public URL getURL() Overrides org. Implements org. This implementation returns the underlying URL reference.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides org. This implementation returns the hash code of the underlying URL reference.
| |
| isFile | back to summary |
|---|---|
| public boolean isFile() Overrides org. Overrides default org. Doc from org. This implementation always returns
| |