public interface ResourceConnector
Base interface for customizing where resources can be found for the GroovyScriptEngine.
| Type Params | Return Type | Name and description |
|---|---|---|
|
public URLConnection |
getResourceConnection(String name)Retrieve a URLConnection to a script referenced by name. |
Retrieve a URLConnection to a script referenced by name.
Two shapes of name are passed. Most lookups use a resource name relative to
whatever roots the connector searches, with package separators written as
'/' on every platform, for example com/example/Foo.groovy.
Staleness checks and dependency resolution during recompilation instead pass
back a name the connector itself resolved earlier, in the external form of
that resource's URL, for example file:/srv/scripts/com/example/Foo.groovy.
An implementation that resolves names against a base should therefore cope
with an already-absolute name; URI.resolve, which
GroovyScriptEngine itself uses, has that behaviour.
The caller may close the returned connection once it has what it needs, which for some call sites is only URLConnection.getURL.
name - the resource to resolve, as described abovenull