@Override public synchronized void write(int b) throws IOException { _buf[0]=(byte)b; write(_buf); } }
@POST /* Maybe should be PUT, but too many hooks only use POST */ @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON}) @Path("/{name}/deploy") @Description(value = "Deploys an app", details = "Deploys the app by fetching the latest changes from git, building it, " + "starting it, polling for successful startup by making GET requests to /{name}/, and if it returns any HTTP response " + "it shuts down the old version of the app. If any steps before that fail, the old version of the app will continue serving " + "requests.") @ApiResponse(code = "200", message = "Returns 200 if the command was received successfully. Whether the build " + "actually succeeds or fails is ignored. Returns streamed plain text of the build log and console startup, unless the Accept" + " header includes 'application/json'.") public Response deploy(@Context UriInfo uriInfo, @Description(value = "The type of response desired, e.g. application/json or text/plain", example = "application/json") @HeaderParam("Accept") String accept, @Required @Description(value="The name of the app", example = "app-runner-home") @PathParam("name") String name) throws IOException { StreamingOutput stream = new UpdateStreamer(name); if (MediaType.APPLICATION_JSON.equals(accept)) { StringBuilderWriter output = new StringBuilderWriter(); try (WriterOutputStream writer = new WriterOutputStream(output)) { stream.write(writer); return app(uriInfo, name); } } else { return Response.ok(stream).build(); } }
out = new WriterOutputStream(response.getWriter());
out = new WriterOutputStream(response.getWriter());
@Override public synchronized void write(int b) throws IOException { _buf[0]=(byte)b; write(_buf); } }
private static Executor createExecutor(LineConsumer consoleLogHandler, CommandLine command, File projectRoot, ExecuteWatchdog watchDog) { Executor executor = new DefaultExecutor(); executor.setWorkingDirectory(projectRoot); executor.setWatchdog(watchDog); executor.setStreamHandler(new PumpStreamHandler(new WriterOutputStream(new WriterToOutputBridge(consoleLogHandler)))); consoleLogHandler.consumeLine(fullPath(executor.getWorkingDirectory()) + "> " + String.join(" ", command.toStrings()) + LINE_SEPARATOR); return executor; }
@Override public synchronized void write(int b) throws IOException { _buf[0]=(byte)b; write(_buf); } }
catch(IllegalStateException e) {out = new WriterOutputStream(response.getWriter());}
@Override public synchronized void write(int b) throws IOException { _buf[0]=(byte)b; write(_buf); } }
catch(IllegalStateException e) {out = new WriterOutputStream(response.getWriter());}
@Override public synchronized void write(int b) throws IOException { _buf[0]=(byte)b; write(_buf); } }
catch(IllegalStateException e) {out = new WriterOutputStream(response.getWriter());}
@Override public synchronized void write(int b) throws IOException { _buf[0]=(byte)b; write(_buf); } }
catch(IllegalStateException e) {out = new WriterOutputStream(response.getWriter());}
@Override public synchronized void write(int b) throws IOException { _buf[0]=(byte)b; write(_buf); } }
catch(IllegalStateException e) {out = new WriterOutputStream(response.getWriter());}
@Override public synchronized void write(int b) throws IOException { _buf[0]=(byte)b; write(_buf); } }
catch(IllegalStateException e) {out = new WriterOutputStream(response.getWriter());}
@Override public synchronized void write(int b) throws IOException { _buf[0]=(byte)b; write(_buf); } }
catch(IllegalStateException e) {out = new WriterOutputStream(response.getWriter());}