Java Code Examples for org.springframework.http.client.MultipartBodyBuilder#build()

The following examples show how to use org.springframework.http.client.MultipartBodyBuilder#build() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MultipartIntegrationTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
private MultiValueMap<String, HttpEntity<?>> generateBody() {
	MultipartBodyBuilder builder = new MultipartBodyBuilder();
	builder.part("fieldPart", "fieldValue");
	builder.part("fileParts", new ClassPathResource("foo.txt", MultipartHttpMessageReader.class));
	builder.part("fileParts", new ClassPathResource("logo.png", getClass()));
	builder.part("jsonPart", new Person("Jason"));
	return builder.build();
}
 
Example 2
Source File: MultipartIntegrationTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
private MultiValueMap<String, HttpEntity<?>> generateBody() {
	MultipartBodyBuilder builder = new MultipartBodyBuilder();
	builder.part("fieldPart", "fieldValue");
	builder.part("fileParts", new ClassPathResource("foo.txt", MultipartHttpMessageReader.class));
	builder.part("fileParts", new ClassPathResource("logo.png", getClass()));
	builder.part("jsonPart", new Person("Jason"));
	return builder.build();
}
 
Example 3
Source File: GraphIntegrationTest.java    From kafka-graphs with Apache License 2.0 5 votes vote down vote up
private MultiValueMap<String, HttpEntity<?>> generateCCBody() {
    MultipartBodyBuilder builder = new MultipartBodyBuilder();
    builder.part("verticesTopic", "initial-cc-vertices");
    builder.part("edgesTopic", "initial-cc-edges");
    builder.part("vertexFile", new ClassPathResource("vertices_simple.txt"));
    builder.part("edgeFile", new ClassPathResource("edges_simple.txt"));
    builder.part("vertexParser", VertexLongIdLongValueParser.class.getName());
    builder.part("edgeParser", EdgeLongIdLongValueParser.class.getName());
    builder.part("keySerializer", LongSerializer.class.getName());
    builder.part("vertexValueSerializer", LongSerializer.class.getName());
    builder.part("edgeValueSerializer", LongSerializer.class.getName());
    builder.part("numPartitions", "50");
    builder.part("replicationFactor", "1");
    return builder.build();
}
 
Example 4
Source File: GraphIntegrationTest.java    From kafka-graphs with Apache License 2.0 5 votes vote down vote up
private MultiValueMap<String, HttpEntity<?>> generateSvdppBody() {
    MultipartBodyBuilder builder = new MultipartBodyBuilder();
    builder.part("edgesTopic", "initial-svdpp-edges");
    builder.part("edgeFile", new ClassPathResource("ratings_simple.txt"));
    builder.part("edgeParser", EdgeCfLongIdFloatValueParser.class.getName());
    builder.part("edgeValueSerializer", FloatSerializer.class.getName());
    builder.part("numPartitions", "50");
    builder.part("replicationFactor", "1");
    return builder.build();
}
 
Example 5
Source File: MultipartIntegrationTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
private MultiValueMap<String, HttpEntity<?>> generateBody() {
	MultipartBodyBuilder builder = new MultipartBodyBuilder();
	builder.part("fooPart", new ClassPathResource("org/springframework/http/codec/multipart/foo.txt"));
	builder.part("barPart", "bar");
	return builder.build();
}
 
Example 6
Source File: MultipartIntegrationTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
private MultiValueMap<String, HttpEntity<?>> generateBody() {
	MultipartBodyBuilder builder = new MultipartBodyBuilder();
	builder.part("fooPart", new ClassPathResource("org/springframework/http/codec/multipart/foo.txt"));
	builder.part("barPart", "bar");
	return builder.build();
}
 
Example 7
Source File: ReactiveIT.java    From errors-spring-boot-starter with Apache License 2.0 4 votes vote down vote up
private MultiValueMap<String, HttpEntity<?>> generateBody() {
    MultipartBodyBuilder builder = new MultipartBodyBuilder();
    builder.part("fieldPart", "fieldValue");
    builder.part("fileParts", new ByteArrayResource("data".getBytes()));
    return builder.build();
}
 
Example 8
Source File: DemoApplicationTests.java    From spring-reactive-sample with GNU General Public License v3.0 4 votes vote down vote up
private MultiValueMap<String, HttpEntity<?>> generateBody() {
    MultipartBodyBuilder builder = new MultipartBodyBuilder();
    builder.part("fileParts", new ClassPathResource("/foo.txt", DemoApplicationTests.class));
    return builder.build();
}
 
Example 9
Source File: FormIntegrationTests.java    From spring-cloud-gateway with Apache License 2.0 4 votes vote down vote up
private MultiValueMap<String, HttpEntity<?>> createMultipartData() {
	ClassPathResource part = new ClassPathResource("1x1.png");
	MultipartBodyBuilder builder = new MultipartBodyBuilder();
	builder.part("imgpart", part, MediaType.IMAGE_PNG);
	return builder.build();
}