|
a/tool/src/main/controller.java |
|
b/tool/src/main/controller.java |
|
... |
|
... |
119 |
// if there is no method selected, just call the default one
|
119 |
// if there is no method selected, just call the default one
|
120 |
if(newRequest.scriptMethod.isEmpty()){
|
120 |
if(newRequest.scriptMethod.isEmpty()){
|
121 |
newRequest.scriptMethod = is.methodDefault;
|
121 |
newRequest.scriptMethod = is.methodDefault;
|
122 |
}
|
122 |
}
|
123 |
|
123 |
|
|
|
124 |
// we need the base folder to be defined as well
|
|
|
125 |
newRequest.BaseFolder = newRequest.scriptFile.getParentFile();
|
|
|
126 |
newRequest.scriptFolder = newRequest.BaseFolder;
|
|
|
127 |
|
124 |
|
128 |
|
125 |
// do a unique id for this request
|
129 |
// do a unique id for this request
|
126 |
long randomTime = System.currentTimeMillis();
|
130 |
long randomTime = System.currentTimeMillis();
|
127 |
String randomId = "request" + randomTime;
|
131 |
String randomId = "request" + randomTime;
|
128 |
// place this request in our memory
|
132 |
// place this request in our memory
|
|
... |
|
... |
137 |
+ "plugin." + newRequest.scriptMethod + "(webRequest);";
|
141 |
+ "plugin." + newRequest.scriptMethod + "(webRequest);";
|
138 |
// run the script file
|
142 |
// run the script file
|
139 |
core.script.runJava(newRequest.scriptFile, command, is.plugin);
|
143 |
core.script.runJava(newRequest.scriptFile, command, is.plugin);
|
140 |
|
144 |
|
141 |
WebRequest processedRequest = (WebRequest) core.temp.get(randomId);
|
145 |
WebRequest processedRequest = (WebRequest) core.temp.get(randomId);
|
|
|
146 |
|
|
|
147 |
// we might have cases where the request is null
|
|
|
148 |
String result = "";
|
|
|
149 |
if(processedRequest != null){
|
142 |
String result = processedRequest.getAnswer();
|
150 |
result = processedRequest.getAnswer();
|
|
|
151 |
//return null;
|
|
|
152 |
}
|
|
|
153 |
|
143 |
// remove it from the memory
|
154 |
// remove it from the memory
|
144 |
core.temp.remove(randomId);
|
155 |
core.temp.remove(randomId);
|
145 |
|
156 |
|
146 |
return result;
|
157 |
return result;
|
147 |
}
|
158 |
}
|