/** * Converts this response to a streaming form (LiveHttpResponse). * <p> * Converts this response to an LiveHttpResponse object which represents the HTTP response as a * stream of bytes. * * @return A streaming LiveHttpResponse object */ public LiveHttpResponse stream() { if (this.body.length == 0) { return new LiveHttpResponse.Builder(this, new ByteStream(Flux.empty())).build(); } else { return new LiveHttpResponse.Builder(this, new ByteStream(Flux.just(new Buffer(copiedBuffer(this.body))))).build(); } }
public Transformer(LiveHttpResponse response) { this.builder = new Builder(response); }
/** * Creates an HTTP response builder with a given status and body. * * @param status response status * @param body response body * @return a new builder */ public static Builder response(HttpResponseStatus status, ByteStream body) { return new Builder(status).body(body); }
private static LiveHttpResponse error(HttpResponseStatus status) { return new LiveHttpResponse.Builder(status) .body(new ByteStream(Flux.just(new Buffer(status.description(), UTF_8)))) .build(); }
/** * Creates an HTTP response builder with a status of 200 OK and empty body. * * @return a new builder */ public static Builder response() { return new Builder(); }
/** * Creates an HTTP response builder with a given status and empty body. * * @param status response status * @return a new builder */ public static Builder response(HttpResponseStatus status) { return new Builder(status); }