Interface ResourceConnector
- All Known Implementing Classes:
AbstractHttpServlet,GroovyScriptEngine,GroovyServlet,TemplateServlet
GroovyScriptEngine.-
Method Summary
Modifier and TypeMethodDescriptiongetResourceConnection(String name) Retrieve a URLConnection to a script referenced by name.
-
Method Details
-
getResourceConnection
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 examplecom/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 examplefile:/srv/scripts/com/example/Foo.groovy. An implementation that resolves names against a base should therefore cope with an already-absolute name;URI.resolve(String), whichGroovyScriptEngineitself 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().- Parameters:
name- the resource to resolve, as described above- Returns:
- an open connection to the resource, never
null - Throws:
ResourceException- if the resource cannot be found or opened
-