public static HttpResponseStatus statusWithCode(int code) { if (code < 0 || code >= STATUSES.length || STATUSES[code] == null) { return new HttpResponseStatus(code, "Unknown status"); } return STATUSES[code]; }
public Builder(HttpResponse response, Observable<ByteBuf> decoded) { this.status = statusWithCode(response.status().code()); this.version = httpVersion(response.version().toString()); this.headers = response.headers().newBuilder(); this.body = decoded; this.cookies = new ArrayList<>(response.cookies()); }
public Builder(HttpResponse response, byte[] encodedBody) { this.status = statusWithCode(response.status().code()); this.version = httpVersion(response.version().toString()); this.headers = response.headers().newBuilder(); this.body = encodedBody; this.cookies = new ArrayList<>(response.cookies()); }
public Builder(FullHttpResponse response, Observable<ByteBuf> body) { this.status = HttpResponseStatus.valueOf(response.status().code()); headers(response.headers().newBuilder()); this.cookies = new ArrayList<>(response.cookies()); version(HttpVersion.valueOf(response.version().toString())); body(body); }