@Controller public class ScriptRunnerController extends Object
Url: /scripts/${scriptname}/run
If the script generates an outputfile that file is streamed to the outputstream else the script output
| Constructor and Description |
|---|
ScriptRunnerController(org.molgenis.script.ScriptJobExecutionFactory scriptJobExecutionFactory,
JobExecutor jobExecutor,
SavedScriptRunner savedScriptRunner,
com.google.gson.Gson gson,
org.molgenis.security.user.UserAccountService userAccountService,
JobsController jobsController) |
| Modifier and Type | Method and Description |
|---|---|
void |
handleGenerateScriptException(ScriptException e,
javax.servlet.http.HttpServletResponse response) |
void |
handleUnknownScriptException(UnknownScriptException e,
javax.servlet.http.HttpServletResponse response) |
void |
runScript(String scriptName,
Map<String,Object> parameters,
javax.servlet.http.HttpServletResponse response)
Runs a Script, waits for it to finish and returns the result.
|
void |
startScript(String scriptName,
Map<String,Object> parameters,
javax.servlet.http.HttpServletResponse response)
Starts a Script.
|
public ScriptRunnerController(org.molgenis.script.ScriptJobExecutionFactory scriptJobExecutionFactory,
JobExecutor jobExecutor,
SavedScriptRunner savedScriptRunner,
com.google.gson.Gson gson,
org.molgenis.security.user.UserAccountService userAccountService,
JobsController jobsController)
@RequestMapping(value="/scripts/{name}/start")
public void startScript(@PathVariable(value="name")
String scriptName,
@RequestParam
Map<String,Object> parameters,
javax.servlet.http.HttpServletResponse response)
throws IOException
ScriptJobExecution. The Script's output will be written to the log of the
ScriptJobExecution. If the Script has an outputFile, the URL of that file will be
written to the JobExecution.getResultUrl()scriptName - name of the Script to startparameters - parameter values for the scriptIOException - if an input or output exception occurs when redirecting@RequestMapping(value="/scripts/{name}/run")
public void runScript(@PathVariable(value="name")
String scriptName,
@RequestParam
Map<String,Object> parameters,
javax.servlet.http.HttpServletResponse response)
throws IOException
If the result has an outputFile, will redirect to a URL where you can download the result file. Otherwise, if the result has output, will write the script output to the response and serve it as /text/plain.
scriptName - name of the Script to runparameters - parameter values for the scriptresponse - HttpServletResponse to return the resultIOException - if something goes wrong when redirecting or writing the resultScriptException - if the script name is unknown or one of the script parameters is
missing@ExceptionHandler(value=org.molgenis.script.core.UnknownScriptException.class) public void handleUnknownScriptException(UnknownScriptException e, javax.servlet.http.HttpServletResponse response) throws IOException
IOException@ExceptionHandler(value=org.molgenis.script.core.ScriptException.class) public void handleGenerateScriptException(ScriptException e, javax.servlet.http.HttpServletResponse response) throws IOException
IOExceptionCopyright © 2018 Pivotal Software, Inc.. All rights reserved.