use of app.hongs.action.ActionHelper in project HongsCORE by ihongs.
the class Common method execAction.
@Cmdlet("exec-action")
public static void execAction(String[] args) throws HongsException {
Map<String, Object> opts;
opts = CmdletHelper.getOpts(args, "request:s", "context:s", "session:s", "cookies:s");
args = (String[]) opts.get("");
if (args.length == 0) {
System.err.println("Action name required!\r\nUsage: ACTION_NAME --request QUERY_STRING --cookies QUERY_STRING --session QUERY_STRING --context QUERY_STRING");
return;
}
ActionHelper helper = Core.getInstance(ActionHelper.class);
helper.setRequestData(data((String) opts.get("request")));
helper.setContextData(data((String) opts.get("context")));
helper.setSessionData(data((String) opts.get("session")));
helper.setCookiesData(data((String) opts.get("cookies")));
ActionRunner runner = new ActionRunner(helper, args[0]);
runner.doAction();
CmdletHelper.preview(helper.getResponseData());
}
Aggregations