Get a new GroovyCodeSource for a script which may be given as a location (isScript is true) or as text (isScript is false). @param isScriptFile indicates whether the script parameter is a location or content @param script the location or context of the script @return a new GroovyCodeSource fo
(boolean isScriptFile, String script)
| 500 | * @since 2.3.0 |
| 501 | */ |
| 502 | protected GroovyCodeSource getScriptSource(boolean isScriptFile, String script) throws IOException, URISyntaxException { |
| 503 | //check the script is currently valid before starting a server against the script |
| 504 | if (isScriptFile) { |
| 505 | // search for the file and if it exists don't try to use URIs ... |
| 506 | File scriptFile = huntForTheScriptFile(script); |
| 507 | if (!scriptFile.exists() && URI_PATTERN.matcher(script).matches()) { |
| 508 | return new GroovyCodeSource(new URI(script)); |
| 509 | } |
| 510 | return new GroovyCodeSource(scriptFile); |
| 511 | } |
| 512 | return new GroovyCodeSource(script, "script_from_command_line", GroovyShell.DEFAULT_CODE_BASE); |
| 513 | } |
| 514 | |
| 515 | // RFC2396 |
| 516 | // scheme = alpha *( alpha | digit | "+" | "-" | "." ) |
no test coverage detected