if (scriptPath == null)
throw Tapestry.createRequiredParameterException(this, "scriptPath");
IEngine engine = cycle.getEngine();
IScriptSource source = engine.getScriptSource();
// If the script path is relative, it should be relative to the Script component's
// container (i.e., relative to a page in the application).
IResourceLocation rootLocation =
getContainer().getSpecification().getSpecificationLocation();
IResourceLocation scriptLocation = rootLocation.getRelativeLocation(scriptPath);
try
{
return source.getScript(scriptLocation);
}
catch (RuntimeException ex)
{
throw new ApplicationRuntimeException(ex.getMessage(), this, null, ex);
}