@Controller public class DynamicCodeController extends Object
| Constructor and Description |
|---|
DynamicCodeController() |
| Modifier and Type | Method and Description |
|---|---|
String |
loadJar(String url)
Controller mapping to load local jar file
|
String |
runCode(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String code,
String imports,
String globals,
String methods)
Controller method that will accept java code for compilation and execution
|
String |
setProp(String propkey,
String value)
Set a system property controller endpoint
|
String |
version()
Method to give version of application
|
@ResponseBody
@RequestMapping(value="/jhawtcode",
method=GET)
public String version()
@ResponseBody
@RequestMapping(value="/jhawtcode/dynacode",
method=POST)
public String runCode(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
@RequestParam(required=true,value="code")
String code,
@RequestParam(required=false,value="imports")
String imports,
@RequestParam(required=false,value="globals")
String globals,
@RequestParam(required=false,value="methods")
String methods)
throws IOException,
ClassNotFoundException
request - Spring Controller Parameter for HttpRequestresponse - Spring Controller Parameter for HttpResponsecode - Java code to be executedimports - Java imports to add to codeglobals - Java global variables to add to codemethods - Java methods to add to codeIOExceptionClassNotFoundException@ResponseBody
@RequestMapping(value="/jhawtcode/dynaprop",
method=POST)
public String setProp(@RequestParam(required=true,value="propkey")
String propkey,
@RequestParam(required=true,value="value")
String value)
propkey - Property key to setvalue - Property value to set@ResponseBody
@RequestMapping(value="/jhawtcode/dynajar",
method=POST)
public String loadJar(@RequestParam(required=true,value="url")
String url)
throws MalformedURLException
url - Url of the jar file to be loadedMalformedURLExceptionCopyright © 2014. All rights reserved.