static void install(final Env env, final Config conf) { String path = conf.getString("crash.httpshell.path"); Router router = env.router(); router.get(path + "/{cmd:.*}", router.promise("direct", (req, deferred) -> { MediaType type = req.accepts(MediaType.json) .map(it -> MediaType.json) .orElse(MediaType.html); PluginContext ctx = req.require(PluginContext.class); ShellFactory shellFactory = ctx.getPlugin(ShellFactory.class); Shell shell = shellFactory.create(null); String cmd = req.param("cmd").value().replaceAll("/", " "); ShellProcess process = shell.createProcess(cmd); ShellProcessContext spc = new SimpleProcessContext( result -> deferred.resolve(result.type(type))); process.execute(spc); })); }
process.get().execute(context); break; case "cancel":
public SSHInlineShellProcessContext execute() { process.execute(this); return this; }
public void run() { process.execute(this); }
public BaseProcessContext execute() { process.execute(this); return this; }
void execute() { try { process.execute(this); } catch(final Throwable t) { new Statement() { @Override protected void run() throws Throwable { // If it's not executing then we attempt to end it end(ShellResponse.error(ErrorKind.INTERNAL, "Unexpected process execution error", t)); } }.all(); } }
void run() { Shell sh = task.factory.create(null); ShellProcess sp = sh.createProcess(task.def.getLine()); task.plugin.processes.add(this); task.plugin.history.add(this); while (task.plugin.history.size() > 100) { task.plugin.history.remove(); } active = true; log.log(Level.FINE, "Started task with id=" + task.def.hashCode() + " pattern=" + task.def.getSchedullingPattern() + " : " + task.def.getLine()); sp.execute(context); }
if (session.current.getAndSet(context) == null) { log.fine("Executing \"" + command + "\""); process.execute(context); } else { log.fine("Could not execute \"" + command + "\"");
callee.execute(context); response = ShellResponse.ok();
shellProcess.execute(context);
ProcessHandler context = new ProcessHandler(this, process); handler.set(context); process.execute(context);
public SSHInlineShellProcessContext execute() { process.execute(this); return this; }
public SSHInlineShellProcessContext execute() { process.execute(this); return this; }
public SSHInlineShellProcessContext execute() { process.execute(this); return this; }
public void run() { process.execute(this); }
public void run() { process.execute(this); }
void execute() { try { process.execute(this); } catch(final Throwable t) { new Statement() { @Override protected void run() throws Throwable { // If it's not executing then we attempt to end it end(ShellResponse.error(ErrorKind.INTERNAL, "Unexpected process execution error", t)); } }.all(); } }
void execute() { try { process.execute(this); } catch(final Throwable t) { new Statement() { @Override protected void run() throws Throwable { // If it's not executing then we attempt to end it end(ShellResponse.error(ErrorKind.INTERNAL, "Unexpected process execution error", t)); } }.all(); } }
void execute() { try { process.execute(this); } catch(final Throwable t) { new Statement() { @Override protected void run() throws Throwable { // If it's not executing then we attempt to end it end(ShellResponse.error(ErrorType.INTERNAL, "Unexpected process execution error", t)); } }.all(); } }
current.set(process); try { process.execute(context); try { context.latch.await();