/** * Create a new {@code UrlResource} based on the given URL object. * @param url a URL */ public UrlResource(URL url) { Assert.notNull(url, "URL must not be null"); this.url = url; this.cleanedUrl = getCleanedUrl(this.url, url.toString()); this.uri = null; }
/** * Create a new {@code UrlResource} based on a URL path. * <p>Note: The given path needs to be pre-encoded if necessary. * @param path a URL path * @throws MalformedURLException if the given URL path is not valid * @see java.net.URL#URL(String) */ public UrlResource(String path) throws MalformedURLException { Assert.notNull(path, "Path must not be null"); this.uri = null; this.url = new URL(path); this.cleanedUrl = getCleanedUrl(this.url, path); }
/** * Create a new {@code UrlResource} based on the given URI object. * @param uri a URI * @throws MalformedURLException if the given URL path is not valid * @since 2.5 */ public UrlResource(URI uri) throws MalformedURLException { Assert.notNull(uri, "URI must not be null"); this.uri = uri; this.url = uri.toURL(); this.cleanedUrl = getCleanedUrl(this.url, uri.toString()); }
/** * Create a new {@code UrlResource} based on the given URL object. * @param url a URL */ public UrlResource(URL url) { Assert.notNull(url, "URL must not be null"); this.url = url; this.cleanedUrl = getCleanedUrl(this.url, url.toString()); this.uri = null; }
/** * Create a new {@code UrlResource} based on a URL path. * <p>Note: The given path needs to be pre-encoded if necessary. * @param path a URL path * @throws MalformedURLException if the given URL path is not valid * @see java.net.URL#URL(String) */ public UrlResource(String path) throws MalformedURLException { Assert.notNull(path, "Path must not be null"); this.uri = null; this.url = new URL(path); this.cleanedUrl = getCleanedUrl(this.url, path); }
/** * Create a new {@code UrlResource} based on the given URI object. * @param uri a URI * @throws MalformedURLException if the given URL path is not valid * @since 2.5 */ public UrlResource(URI uri) throws MalformedURLException { Assert.notNull(uri, "URI must not be null"); this.uri = uri; this.url = uri.toURL(); this.cleanedUrl = getCleanedUrl(this.url, uri.toString()); }
/** * Create a new {@code UrlResource} based on a URI specification. * <p>The given parts will automatically get encoded if necessary. * @param protocol the URL protocol to use (e.g. "jar" or "file" - without colon); * also known as "scheme" * @param location the location (e.g. the file path within that protocol); * also known as "scheme-specific part" * @param fragment the fragment within that location (e.g. anchor on an HTML page, * as following after a "#" separator) * @throws MalformedURLException if the given URL specification is not valid * @see java.net.URI#URI(String, String, String) */ public UrlResource(String protocol, String location, @Nullable String fragment) throws MalformedURLException { try { this.uri = new URI(protocol, location, fragment); this.url = this.uri.toURL(); this.cleanedUrl = getCleanedUrl(this.url, this.uri.toString()); } catch (URISyntaxException ex) { MalformedURLException exToThrow = new MalformedURLException(ex.getMessage()); exToThrow.initCause(ex); throw exToThrow; } }
/** * Create a new {@code UrlResource} based on a URI specification. * <p>The given parts will automatically get encoded if necessary. * @param protocol the URL protocol to use (e.g. "jar" or "file" - without colon); * also known as "scheme" * @param location the location (e.g. the file path within that protocol); * also known as "scheme-specific part" * @param fragment the fragment within that location (e.g. anchor on an HTML page, * as following after a "#" separator) * @throws MalformedURLException if the given URL specification is not valid * @see java.net.URI#URI(String, String, String) */ public UrlResource(String protocol, String location, @Nullable String fragment) throws MalformedURLException { try { this.uri = new URI(protocol, location, fragment); this.url = this.uri.toURL(); this.cleanedUrl = getCleanedUrl(this.url, this.uri.toString()); } catch (URISyntaxException ex) { MalformedURLException exToThrow = new MalformedURLException(ex.getMessage()); exToThrow.initCause(ex); throw exToThrow; } }
/** * Create a new UrlResource. * @param path a URL path * @throws MalformedURLException if the given URL path is not valid */ public UrlResource(String path) throws MalformedURLException { Assert.notNull(path, "Path must not be null"); this.url = new URL(path); this.cleanedUrl = getCleanedUrl(this.url, path); this.uri = null; }
/** * Create a new UrlResource. * @param url a URL */ public UrlResource(URL url) { Assert.notNull(url, "URL must not be null"); this.url = url; this.cleanedUrl = getCleanedUrl(this.url, url.toString()); this.uri = null; }
/** * Create a new UrlResource. * @param uri a URI * @throws MalformedURLException if the given URL path is not valid */ public UrlResource(URI uri) throws MalformedURLException { Assert.notNull(uri, "URI must not be null"); this.url = uri.toURL(); this.cleanedUrl = getCleanedUrl(this.url, uri.toString()); this.uri = uri; }
/** * Create a new UrlResource. * @param url a URL */ public UrlResource(URL url) { Assert.notNull(url, "URL must not be null"); this.url = url; this.cleanedUrl = getCleanedUrl(this.url, url.toString()); this.uri = null; }
/** * Create a new {@code UrlResource} based on the given URL object. * @param url a URL */ public UrlResource(URL url) { Assert.notNull(url, "URL must not be null"); this.url = url; this.cleanedUrl = getCleanedUrl(this.url, url.toString()); this.uri = null; }
/** * Create a new UrlResource. * @param path a URL path */ public UrlResource(String path) throws MalformedURLException { Assert.notNull(path, "path is required"); this.url = new URL(path); this.cleanedUrl = getCleanedUrl(this.url, path); }
/** * Create a new UrlResource. * @param url a URL */ public UrlResource(URL url) { Assert.notNull(url, "url is required"); this.url = url; this.cleanedUrl = getCleanedUrl(this.url, url.toString()); }
/** * Create a new UrlResource. * @param path a URL path * @throws MalformedURLException if the given URL path is not valid */ public UrlResource(String path) throws MalformedURLException { Assert.notNull(path, "Path must not be null"); this.url = new URL(path); this.cleanedUrl = getCleanedUrl(this.url, path); this.uri = null; }
/** * Create a new {@code UrlResource} based on the given URL object. * @param url a URL */ public UrlResource(URL url) { Assert.notNull(url, "URL must not be null"); this.url = url; this.cleanedUrl = getCleanedUrl(this.url, url.toString()); this.uri = null; }
/** * Create a new {@code UrlResource} based on the given URI object. * @param uri a URI * @throws MalformedURLException if the given URL path is not valid * @since 2.5 */ public UrlResource(URI uri) throws MalformedURLException { Assert.notNull(uri, "URI must not be null"); this.uri = uri; this.url = uri.toURL(); this.cleanedUrl = getCleanedUrl(this.url, uri.toString()); }
/** * Create a new UrlResource. * @param uri a URI * @throws MalformedURLException if the given URL path is not valid */ public UrlResource(URI uri) throws MalformedURLException { Assert.notNull(uri, "URI must not be null"); this.url = uri.toURL(); this.cleanedUrl = getCleanedUrl(this.url, uri.toString()); this.uri = uri; }
/** * Create a new {@code UrlResource} based on the given URI object. * @param uri a URI * @throws MalformedURLException if the given URL path is not valid * @since 2.5 */ public UrlResource(URI uri) throws MalformedURLException { Assert.notNull(uri, "URI must not be null"); this.uri = uri; this.url = uri.toURL(); this.cleanedUrl = getCleanedUrl(this.url, uri.toString()); }