public class SchemaResolver extends Object
Resources are sought, in order:
getSimpleHttpResourcePath(URI)
).
Constructor and Description |
---|
SchemaResolver()
Convenience constructor for a resolver with neither catalog nor cache (just classpath).
|
SchemaResolver(SchemaCache cache)
Convenience constructor for a resolver with no catalog.
|
SchemaResolver(SchemaCatalog catalog)
Convenience constructor for a resolver with no cache.
|
SchemaResolver(SchemaCatalog catalog,
boolean classpath,
SchemaCache cache)
Constructor.
|
SchemaResolver(SchemaCatalog catalog,
SchemaCache cache)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
static URL |
getClasspathResourceUrl(String location)
Return the URL for a resource found on the classpath at the Simple HTTP Resource Path.
|
static String |
getSimpleHttpResourcePath(String location)
Return the Simple HTTP Resource Path for an absolute http/https URL.
|
static String |
getSimpleHttpResourcePath(String location,
boolean keepQuery)
Return the Simple HTTP Resource Path for an absolute http/https URL.
|
static String |
getSimpleHttpResourcePath(URI location)
Return the Simple HTTP Resource Path for an absolute http/https URL.
|
static String |
getSimpleHttpResourcePath(URI location,
boolean keepQuery)
Return the Simple HTTP Resource Path for an absolute http/https URL.
|
String |
resolve(String location)
Resolve an absolute URL to a local file or jar URL.
|
String |
resolve(String location,
String context)
Resolve an absolute or relative URL to a local file or jar URL.
|
static String |
resolveClasspathLocation(String location)
Return the string representation of URL for a resource found on the classpath at the Simple
HTTP Resource Path.
|
public SchemaResolver(SchemaCatalog catalog, boolean classpath, SchemaCache cache)
catalog
- classpath
- whether schemas can be located on the classpathcache
- public SchemaResolver(SchemaCatalog catalog, SchemaCache cache)
catalog
- cache
- public SchemaResolver()
public SchemaResolver(SchemaCatalog catalog)
catalog
- public SchemaResolver(SchemaCache cache)
cache
- public String resolve(String location, String context)
location
- an absolute or relative URL for a schemacontext
- an absolute URL specifying the context schema of a relative location, or null
if noneRuntimeException
- if a local resource could not be foundpublic String resolve(String location)
location
- an absolute URLRuntimeException
- if a local resource could not be foundpublic static String getSimpleHttpResourcePath(String location)
location
- not nullgetSimpleHttpResourcePath(URI)
public static String getSimpleHttpResourcePath(String location, boolean keepQuery)
location
- not nullkeepQuery
- indicates whether or not the query components should be included in the
path. If this is set to true then the query portion is converted to an MD5 message digest
and that string is used to identify the file in the cache.getSimpleHttpResourcePath(URI, boolean)
public static String getSimpleHttpResourcePath(URI location)
The Simple HTTP Resource Path maps an HTTP or HTTPS URL to a path on the classpath or relative to some other root. To form the Simple HTTP Resource Path from an http/https URL:
http://schemas.example.org/exampleml/exml.xsd
becomes
/org/example/schemas/exampleml/exml.xsd
.
The Simple HTTP Resource Path always starts with a forward slash (if not null). Does not include query components in the path.
location
- not nullpublic static String getSimpleHttpResourcePath(URI location, boolean keepQuery)
The Simple HTTP Resource Path maps an HTTP or HTTPS URL to a path on the classpath or relative to some other root. To form the Simple HTTP Resource Path from an http/https URL:
http://schemas.example.org/exampleml/exml.xsd
becomes
/org/example/schemas/exampleml/exml.xsd
.
The Simple HTTP Resource Path always starts with a forward slash (if not null). Does not include query components in the path.
location
- not nullkeepQuery
- indicates whether or not the query components should be included in the
path. If this is set to true then the query portion is converted to an MD5 message digest
and that string is used to identify the file in the cache.public static URL getClasspathResourceUrl(String location)
location
- public static String resolveClasspathLocation(String location)
location
- Copyright © 1996–2019 Geotools. All rights reserved.