Search in sources :

Example 6 with Part

use of org.asynchttpclient.request.body.multipart.Part in project async-http-client by AsyncHttpClient.

the class RequestBuilderBase method build.

public Request build() {
    RequestBuilderBase<?> rb = executeSignatureCalculator();
    Uri finalUri = rb.computeUri();
    Charset finalCharset = rb.computeCharset();
    // make copies of mutable internal collections
    List<Cookie> cookiesCopy = rb.cookies == null ? Collections.emptyList() : new ArrayList<>(rb.cookies);
    List<Param> formParamsCopy = rb.formParams == null ? Collections.emptyList() : new ArrayList<>(rb.formParams);
    List<Part> bodyPartsCopy = rb.bodyParts == null ? Collections.emptyList() : new ArrayList<>(rb.bodyParts);
    return new //
    DefaultRequest(//
    rb.method, //
    finalUri, //
    rb.address, //
    rb.localAddress, //
    rb.headers, //
    cookiesCopy, //
    rb.byteData, //
    rb.compositeByteData, //
    rb.stringData, //
    rb.byteBufferData, //
    rb.streamData, //
    rb.bodyGenerator, //
    formParamsCopy, //
    bodyPartsCopy, //
    rb.virtualHost, //
    rb.proxyServer, //
    rb.realm, //
    rb.file, //
    rb.followRedirect, //
    rb.requestTimeout, //
    rb.readTimeout, //
    rb.rangeOffset, //
    finalCharset, //
    rb.channelPoolPartitioning, rb.nameResolver);
}
Also used : Cookie(io.netty.handler.codec.http.cookie.Cookie) Part(org.asynchttpclient.request.body.multipart.Part) Charset(java.nio.charset.Charset) Uri(org.asynchttpclient.uri.Uri)

Aggregations

Part (org.asynchttpclient.request.body.multipart.Part)6 HttpResponseBodyPart (org.asynchttpclient.HttpResponseBodyPart)4 RequestBuilder (org.asynchttpclient.RequestBuilder)4 ByteBuf (io.netty.buffer.ByteBuf)1 DefaultHttpHeaders (io.netty.handler.codec.http.DefaultHttpHeaders)1 HttpHeaders (io.netty.handler.codec.http.HttpHeaders)1 Cookie (io.netty.handler.codec.http.cookie.Cookie)1 Charset (java.nio.charset.Charset)1 ArrayList (java.util.ArrayList)1 FileLikePart (org.asynchttpclient.request.body.multipart.FileLikePart)1 MultipartBody (org.asynchttpclient.request.body.multipart.MultipartBody)1 StringPart (org.asynchttpclient.request.body.multipart.StringPart)1 Uri (org.asynchttpclient.uri.Uri)1 Test (org.testng.annotations.Test)1