@Override public Object call() throws Exception { List<Object> info = U.list(); if (ClasspathUtil.hasAppJar()) { info.add(h2("Upload an application JAR to re-deploy:")); info.add(hardcoded("<form action=\"/_/jar\" class=\"dropzone\" id=\"jar-upload\"></form>")); String token = U.or(ReqInfo.get().cookies().get("_token"), ""); info.add(h2("HTTP API for Deployment:")); info.add(h6(verb(HttpVerb.POST), b(" http://your-app-domain/_/jar?_token=<token>"))); info.add(h6(b("POST DATA: file=<your-jar>"))); info.add(h2("Building and deploying with Maven:")); String cmd = "mvn clean package && cp target/*.jar target/_app_.jar && curl -F 'file=@target/_app_.jar' 'http://localhost:8888/_/jar?_token=" + token + "'"; info.add(h6(copy(b(cmd)))); Btn shutdown = btn("Shutdown / Restart") .danger() .confirm("Do you really want to SHUTDOWN / RESTART the application?") .onClick( new Runnable() { @Override public void run() { TerminateHandler.shutdownSoon(); } }); info.add(br()); info.add(shutdown); } else { info.add( h3( WARN, " No ", b("app.jar"), " file was configured on the classpath, so application deployment is disabled!")); info.add( h4( "Application deployment works by uploading a JAR which overwrites the file 'app.jar', and restarting the application.")); } return multi(info); }
@Override public T get() { return (T) ReqInfo.get().posted().get(name()); }