public static class UrlStreamHandlers.ResolversUrl extends UrlStreamHandlers.ResolvingUrl
An URL stream handler that resolves to another URL schema - use this to build custom URL schemas that can shorten URIs or lookup resources.
This class accepts resolver strategies as lambdas in the constructor.
This is convenient when you just want to pass a method reference to a getResources()
method as in this example:
package sun.net.www.protocol.cp;
public class Handler extends UrlStreamHandlers.ResolversUrl {
public Handler() { super(Foobar.class.getClassLoader::getResource, ClassLoader::getSystemResource); }
}
Constructor and Description |
---|
ResolversUrl(Function<String,URL>... resolvers) |
Modifier and Type | Method and Description |
---|---|
protected URL |
resolve(String resourcePath) |
openConnection
equals, getDefaultPort, getHostAddress, hashCode, hostsEqual, openConnection, parseURL, sameFile, setURL, setURL, toExternalForm
@SafeVarargs public ResolversUrl(Function<String,URL>... resolvers)
protected URL resolve(String resourcePath)
resolve
in class UrlStreamHandlers.ResolvingUrl