本文整理汇总了Java中org.asynchttpclient.request.body.multipart.Part类的典型用法代码示例。如果您正苦于以下问题:Java Part类的具体用法?Java Part怎么用?Java Part使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Part类属于org.asynchttpclient.request.body.multipart包,在下文中一共展示了Part类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addBodyPart
import org.asynchttpclient.request.body.multipart.Part; //导入依赖的package包/类
public T addBodyPart(Part bodyPart) {
resetFormParams();
resetNonMultipartData();
if (this.bodyParts == null)
this.bodyParts = new ArrayList<>();
this.bodyParts.add(bodyPart);
return asDerivedType();
}
示例2: build
import org.asynchttpclient.request.body.multipart.Part; //导入依赖的package包/类
public Request build() {
RequestBuilderBase<?> rb = executeSignatureCalculator();
Uri finalUri = rb.computeUri();
Charset finalCharset = rb.computeCharset();
long finalContentLength = rb.computeRequestContentLength();
// 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,//
finalContentLength,//
rb.proxyServer,//
rb.realm,//
rb.file,//
rb.followRedirect,//
rb.requestTimeout,//
rb.rangeOffset,//
finalCharset,//
rb.channelPoolPartitioning,//
rb.nameResolver);
}
示例3: main
import org.asynchttpclient.request.body.multipart.Part; //导入依赖的package包/类
public static void main(String[] args) throws Exception{
Part part = new StringPart("niad","hah");
Request request = post("http://127.0.0.1:8080").addBodyPart(part).build();
try(AsyncHttpClient asyncHttpClient = asyncHttpClient()) {
asyncHttpClient
.prepareRequest(request)
.execute()
.toCompletableFuture()
.thenApply(Response::getResponseBody)
.thenAccept(System.out::println)
.join();
}
}
示例4: NettyMultipartBody
import org.asynchttpclient.request.body.multipart.Part; //导入依赖的package包/类
public NettyMultipartBody(List<Part> parts, HttpHeaders headers, AsyncHttpClientConfig config) {
this(newMultipartBody(parts, headers), config);
}
示例5: DefaultRequest
import org.asynchttpclient.request.body.multipart.Part; //导入依赖的package包/类
public DefaultRequest(String method,//
Uri uri,//
InetAddress address,//
InetAddress localAddress,//
HttpHeaders headers,//
List<Cookie> cookies,//
byte[] byteData,//
List<byte[]> compositeByteData,//
String stringData,//
ByteBuffer byteBufferData,//
InputStream streamData,//
BodyGenerator bodyGenerator,//
List<Param> formParams,//
List<Part> bodyParts,//
String virtualHost,//
long contentLength,//
ProxyServer proxyServer,//
Realm realm,//
File file,//
Boolean followRedirect,//
int requestTimeout,//
long rangeOffset,//
Charset charset,//
ChannelPoolPartitioning channelPoolPartitioning,//
NameResolver<InetAddress> nameResolver) {
this.method = method;
this.uri = uri;
this.address = address;
this.localAddress = localAddress;
this.headers = headers;
this.cookies = cookies;
this.byteData = byteData;
this.compositeByteData = compositeByteData;
this.stringData = stringData;
this.byteBufferData = byteBufferData;
this.streamData = streamData;
this.bodyGenerator = bodyGenerator;
this.formParams = formParams;
this.bodyParts = bodyParts;
this.virtualHost = virtualHost;
this.contentLength = contentLength;
this.proxyServer = proxyServer;
this.realm = realm;
this.file = file;
this.followRedirect = followRedirect;
this.requestTimeout = requestTimeout;
this.rangeOffset = rangeOffset;
this.charset = charset;
this.channelPoolPartitioning = channelPoolPartitioning;
this.nameResolver = nameResolver;
}
示例6: getBodyParts
import org.asynchttpclient.request.body.multipart.Part; //导入依赖的package包/类
@Override
public List<Part> getBodyParts() {
return bodyParts;
}
示例7: setBodyParts
import org.asynchttpclient.request.body.multipart.Part; //导入依赖的package包/类
public T setBodyParts(List<Part> bodyParts) {
this.bodyParts = new ArrayList<>(bodyParts);
return asDerivedType();
}
示例8: getBodyParts
import org.asynchttpclient.request.body.multipart.Part; //导入依赖的package包/类
/**
* Return the current {@link Part}
*
* @return the current {@link Part}
*/
List<Part> getBodyParts();