Builder(StreamingHttpRequest request) { this.id = request.id(); this.method = request.method(); this.clientAddress = request.clientAddress(); this.url = request.url(); this.secure = request.isSecure(); this.version = request.version(); this.headers = request.headers().newBuilder(); this.body = request.body(); this.cookies = new ArrayList<>(request.cookies()); }
/** * Builds a new full request based on the settings configured in this builder. * If {@code validate} is set to true: * <ul> * <li>the host header will be set if absent</li> * <li>an exception will be thrown if the content length is not an integer, or more than one content length exists</li> * <li>an exception will be thrown if the request method is not a valid HTTP method</li> * </ul> * * @return a new full request */ public StreamingHttpRequest build() { if (validate) { ensureContentLengthIsValid(); ensureMethodIsValid(); setHostHeader(); } return new StreamingHttpRequest(this); }
public Builder(StreamingHttpRequest request, byte[] body) { this.id = request.id(); this.method = request.method(); this.clientAddress = request.clientAddress(); this.url = request.url(); this.secure = request.isSecure(); this.version = request.version(); this.headers = request.headers().newBuilder(); this.body = body; this.cookies = new ArrayList<>(request.cookies()); }