use of io.netty.handler.codec.http.multipart.MemoryFileUpload in project reactor-netty by reactor.
the class HttpClientFormEncoder method textFile.
@Override
public HttpClientRequest.Form textFile(String name, InputStream stream, String contentType) {
Objects.requireNonNull(name, "name");
Objects.requireNonNull(stream, "stream");
try {
String scontentType = contentType;
if (contentType == null) {
scontentType = DEFAULT_TEXT_CONTENT_TYPE;
}
MemoryFileUpload fileUpload = new MemoryFileUpload(name, "", scontentType, null, newCharset, -1);
fileUpload.setMaxSize(-1);
fileUpload.setContent(stream);
addBodyHttpData(fileUpload);
} catch (ErrorDataEncoderException e) {
throw Exceptions.propagate(e);
} catch (IOException e) {
throw Exceptions.propagate(new ErrorDataEncoderException(e));
}
return this;
}
use of io.netty.handler.codec.http.multipart.MemoryFileUpload in project reactor-netty by reactor.
the class HttpClientFormEncoder method file.
@Override
public HttpClientRequest.Form file(String name, String filename, InputStream stream, String contentType) {
Objects.requireNonNull(name, "name");
Objects.requireNonNull(stream, "stream");
try {
String scontentType = contentType;
if (contentType == null) {
scontentType = DEFAULT_BINARY_CONTENT_TYPE;
}
MemoryFileUpload fileUpload = new MemoryFileUpload(name, filename, scontentType, DEFAULT_TRANSFER_ENCODING, newCharset, -1);
fileUpload.setMaxSize(-1);
fileUpload.setContent(stream);
addBodyHttpData(fileUpload);
} catch (ErrorDataEncoderException e) {
throw Exceptions.propagate(e);
} catch (IOException e) {
throw Exceptions.propagate(new ErrorDataEncoderException(e));
}
return this;
}
use of io.netty.handler.codec.http.multipart.MemoryFileUpload in project jocean-http by isdom.
the class HttpPostRequestEncoderTestCase method testMemoryFileUploadEquals.
@Test
public final void testMemoryFileUploadEquals() {
final MemoryFileUpload f1 = new MemoryFileUpload("m1", "m1", "application/json", null, null, 100);
assertEquals(f1, f1);
}
use of io.netty.handler.codec.http.multipart.MemoryFileUpload in project reactor-netty by reactor.
the class HttpClientFormEncoder method file.
@Override
public HttpClientForm file(String name, String filename, InputStream stream, @Nullable String contentType) {
Objects.requireNonNull(name, "name");
Objects.requireNonNull(stream, "stream");
try {
String scontentType = contentType;
if (contentType == null) {
scontentType = DEFAULT_BINARY_CONTENT_TYPE;
}
MemoryFileUpload fileUpload = new MemoryFileUpload(name, filename, scontentType, DEFAULT_TRANSFER_ENCODING, newCharset, -1);
fileUpload.setMaxSize(-1);
fileUpload.setContent(stream);
addBodyHttpData(fileUpload);
} catch (ErrorDataEncoderException e) {
throw Exceptions.propagate(e);
} catch (IOException e) {
throw Exceptions.propagate(new ErrorDataEncoderException(e));
}
return this;
}
use of io.netty.handler.codec.http.multipart.MemoryFileUpload in project reactor-netty by reactor.
the class HttpClientFormEncoder method textFile.
@Override
public HttpClientForm textFile(String name, InputStream stream, @Nullable String contentType) {
Objects.requireNonNull(name, "name");
Objects.requireNonNull(stream, "stream");
try {
String scontentType = contentType;
if (contentType == null) {
scontentType = DEFAULT_TEXT_CONTENT_TYPE;
}
MemoryFileUpload fileUpload = new MemoryFileUpload(name, "", scontentType, null, newCharset, -1);
fileUpload.setMaxSize(-1);
fileUpload.setContent(stream);
addBodyHttpData(fileUpload);
} catch (ErrorDataEncoderException e) {
throw Exceptions.propagate(e);
} catch (IOException e) {
throw Exceptions.propagate(new ErrorDataEncoderException(e));
}
return this;
}
Aggregations