Example usage for io.netty.handler.codec.http.multipart MemoryFileUpload setMaxSize

List of usage examples for io.netty.handler.codec.http.multipart MemoryFileUpload setMaxSize

Introduction

In this page you can find the example usage for io.netty.handler.codec.http.multipart MemoryFileUpload setMaxSize.

Prototype

@Override
    public void setMaxSize(long maxSize) 

Source Link

Usage

From source file:reactor.ipc.netty.http.client.HttpClientFormEncoder.java

License:Open Source License

@Override
public HttpClientRequest.Form file(String name, String filename, InputStream stream, String contentType) {
    Objects.requireNonNull(name, "name");
    Objects.requireNonNull(stream, "stream");
    try {/*from   ww  w  . j ava 2  s  .c o m*/
        String scontentType = contentType;
        if (contentType == null) {
            scontentType = DEFAULT_BINARY_CONTENT_TYPE;
        }
        MemoryFileUpload fileUpload = new MemoryFileUpload(name, filename, scontentType,
                DEFAULT_TRANSFER_ENCODING, charset, -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;
}

From source file:reactor.ipc.netty.http.client.HttpClientFormEncoder.java

License:Open Source License

@Override
public HttpClientRequest.Form textFile(String name, InputStream stream, String contentType) {
    Objects.requireNonNull(name, "name");
    Objects.requireNonNull(stream, "stream");
    try {/*from   w  w  w.  ja  v  a  2 s . c o m*/
        String scontentType = contentType;

        if (contentType == null) {
            scontentType = DEFAULT_TEXT_CONTENT_TYPE;
        }

        MemoryFileUpload fileUpload = new MemoryFileUpload(name, "", scontentType, null, charset, -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;
}