Top Description Fields Constructors Methods
reactor.netty5.http.client

pack-priv final Class HttpClientFormEncoder

extends HttpPostRequestEncoder
implements ChunkedInput<HttpContent<?>>, Runnable, HttpClientForm
Class Inheritance
All Implemented Interfaces
reactor.netty5.http.client.HttpClientForm, java.lang.Runnable, io.netty5.handler.stream.ChunkedInput, java.lang.AutoCloseable
Annotations
@SuppressWarnings:try
Imports
java.io.File, .IOException, .InputStream, java.nio.charset.Charset, java.util.HashMap, .Map, .Objects, java.util.regex.Pattern, io.netty5.buffer.BufferAllocator, io.netty5.handler.codec.http.HttpContent, .HttpRequest, io.netty.contrib.handler.codec.http.multipart.DiskAttribute, .DiskFileUpload, .FileUpload, .HttpDataFactory, .HttpPostRequestEncoder, io.netty5.handler.stream.ChunkedInput, reactor.core.Exceptions, reactor.core.publisher.Sinks, reactor.util.annotation.Nullable

Modified io.netty.contrib.handler.codec.http.multipart.HttpPostRequestEncoder for optional filename and builder support

This encoder will help to encode Request for a FORM as POST.

Field Summary

Modifier and TypeField and Description
pack-priv boolean
pack-priv static final String
pack-priv static final String
pack-priv static final String
pack-priv boolean
pack-priv Charset
pack-priv HttpDataFactory
pack-priv HttpPostRequestEncoder.EncoderMode
pack-priv boolean
pack-priv static final Map<Pattern, String>
pack-priv final Sinks.Many<Long>
pack-priv final HttpRequest

Constructor Summary

AccessConstructor and Description
pack-priv
HttpClientFormEncoder(HttpDataFactory
the factory used to create InterfaceHttpData
factory
,
HttpRequest
the request to encode
request
,
boolean
True if the FORM is a ENCTYPE="multipart/form-data"
multipart
,
Charset
the charset to use as default
charset
,
HttpPostRequestEncoder.EncoderMode
the mode for the encoder to use. See EncoderMode for the details.
encoderMode
)

Method Summary

Modifier and TypeMethod and Description
pack-priv final HttpClientFormEncoder
public HttpClientForm
attr(String
Attribute name
name
,
String
Attribute value
value
)

Implements reactor.netty5.http.client.HttpClientForm.attr.

Add an HTTP Form attribute
public HttpClientForm
charset(Charset
form charset
charset
)

Implements reactor.netty5.http.client.HttpClientForm.charset.

Set the Form Charset
public HttpClientForm
cleanOnTerminate(boolean
true if cleaned on termination (successful or failed)
clean
)

Implements reactor.netty5.http.client.HttpClientForm.cleanOnTerminate.

Should file attributes be cleaned and eventually removed from disk.
public HttpClientForm
encoding(HttpPostRequestEncoder.EncoderMode
the encoding mode for this form encoding
mode
)

Implements reactor.netty5.http.client.HttpClientForm.encoding.

Set Form encoding
public HttpClientForm
factory(HttpDataFactory
the new HttpDataFactory to use
factory
)

Implements reactor.netty5.http.client.HttpClientForm.factory.

Set Upload factories (allows memory threshold configuration)
public HttpClientForm
file(String
File name
name
,
File
File reference
file
)

Implements reactor.netty5.http.client.HttpClientForm.file.

Add an HTTP File Upload attribute
public HttpClientForm
file(String
File name
name
,
InputStream
File content as InputStream
inputStream
)

Implements reactor.netty5.http.client.HttpClientForm.file.

Add an HTTP File Upload attribute
public HttpClientForm
file(String
File name
name
,
String
File name to override origin name
filename
,
File
File reference
file
,
String
File mime-type
contentType
)

Implements reactor.netty5.http.client.HttpClientForm.file.

Add an HTTP File Upload attribute
public HttpClientForm
file(String
File name
name
,
String
File name to override origin name
filename
,
InputStream
File content as InputStream
stream
,
String
File mime-type
contentType
)

Implements reactor.netty5.http.client.HttpClientForm.file.

Add an HTTP File Upload attribute
public HttpClientForm
files(String
File name
name
,
File[]
File references
files
,
String[]
File mime-types in the same order than file references
contentTypes
)

Implements reactor.netty5.http.client.HttpClientForm.files.

Add an HTTP File Upload attribute
public HttpClientForm
files(String
File name
name
,
File[]
File references
files
,
String[]
File mime-type in the same order than file references
contentTypes
,
boolean[]
Plain-Text transmission in the same order than file references
textFiles
)

Implements reactor.netty5.http.client.HttpClientForm.files.

Add an HTTP File Upload attribute
public HttpClientForm
multipart(boolean
should this form be encoded as Multipart
isMultipart
)

Implements reactor.netty5.http.client.HttpClientForm.multipart.

Define if this request will be encoded as Multipart
public HttpContent<?>
readChunk(BufferAllocator
BufferAllocator if buffer allocation is necessary.
allocator
)

Overrides io.netty.contrib.handler.codec.http.multipart.HttpPostRequestEncoder.readChunk.

Implements io.netty5.handler.stream.ChunkedInput.readChunk.

Fetches a chunked data from the stream.
public void
run()

Implements java.lang.Runnable.run.

Runs this operation.
public HttpClientForm
textFile(String
Text file name
name
,
File
Text File reference
file
)

Implements reactor.netty5.http.client.HttpClientForm.textFile.

Add an HTTP File Upload attribute for a text file.
public HttpClientForm
textFile(String
Text file name
name
,
File
Text File reference
file
,
String
Text file mime-type
contentType
)

Implements reactor.netty5.http.client.HttpClientForm.textFile.

Add an HTTP File Upload attribute for a text file.
public HttpClientForm
textFile(String
Text file name
name
,
InputStream
Text file content as InputStream
stream
)

Implements reactor.netty5.http.client.HttpClientForm.textFile.

Add an HTTP File Upload attribute for a text file.
public HttpClientForm
textFile(String
Text file name
name
,
InputStream
Text file content as InputStream
stream
,
String
Text file mime-type
contentType
)

Implements reactor.netty5.http.client.HttpClientForm.textFile.

Add an HTTP File Upload attribute for a text file.
Inherited from io.netty.contrib.handler.codec.http.multipart.HttpPostRequestEncoder:
addBodyAttributeaddBodyFileUploadaddBodyFileUploadaddBodyFileUploadsaddBodyHttpDatacleanFilesclosefinalizeRequestgetBodyListAttributesisChunkedisEndOfInputisMultipartlengthprogresssetBodyHttpDatas

Field Detail

cleanOnTerminateback to summary
pack-priv boolean cleanOnTerminate
DEFAULT_BINARY_CONTENT_TYPEback to summary
pack-priv static final String DEFAULT_BINARY_CONTENT_TYPE
DEFAULT_TEXT_CONTENT_TYPEback to summary
pack-priv static final String DEFAULT_TEXT_CONTENT_TYPE
DEFAULT_TRANSFER_ENCODINGback to summary
pack-priv static final String DEFAULT_TRANSFER_ENCODING
needNewEncoderback to summary
pack-priv boolean needNewEncoder
newCharsetback to summary
pack-priv Charset newCharset
newFactoryback to summary
pack-priv HttpDataFactory newFactory
newModeback to summary
pack-priv HttpPostRequestEncoder.EncoderMode newMode
newMultipartback to summary
pack-priv boolean newMultipart
percentEncodingsback to summary
pack-priv static final Map<Pattern, String> percentEncodings

Hides io.netty.contrib.handler.codec.http.multipart.HttpPostRequestEncoder.percentEncodings.

progressSinkback to summary
pack-priv final Sinks.Many<Long> progressSink
requestback to summary
pack-priv final HttpRequest request

Hides io.netty.contrib.handler.codec.http.multipart.HttpPostRequestEncoder.request.

Constructor Detail

HttpClientFormEncoderback to summary
pack-priv HttpClientFormEncoder(HttpDataFactory factory, HttpRequest request, boolean multipart, Charset charset, HttpPostRequestEncoder.EncoderMode encoderMode) throws ErrorDataEncoderException
Parameters
factory:HttpDataFactory

the factory used to create InterfaceHttpData

request:HttpRequest

the request to encode

multipart:boolean

True if the FORM is a ENCTYPE="multipart/form-data"

charset:Charset

the charset to use as default

encoderMode:HttpPostRequestEncoder.EncoderMode

the mode for the encoder to use. See EncoderMode for the details.

Exceptions
ErrorDataEncoderException:
if the request is not a POST
NullPointerException:
for request or charset or factory

Method Detail

applyChangesback to summary
pack-priv final HttpClientFormEncoder applyChanges(HttpRequest request)
attrback to summary
public HttpClientForm attr(String name, String value)

Implements reactor.netty5.http.client.HttpClientForm.attr.

Doc from reactor.netty5.http.client.HttpClientForm.attr.

Add an HTTP Form attribute

Parameters
name:String

Attribute name

value:String

Attribute value

Returns:HttpClientForm

this builder

Annotations
@Override
charsetback to summary
public HttpClientForm charset(Charset charset)

Implements reactor.netty5.http.client.HttpClientForm.charset.

Doc from reactor.netty5.http.client.HttpClientForm.charset.

Set the Form Charset

Parameters
charset:Charset

form charset

Returns:HttpClientForm

this builder

Annotations
@Override
cleanOnTerminateback to summary
public HttpClientForm cleanOnTerminate(boolean clean)

Implements reactor.netty5.http.client.HttpClientForm.cleanOnTerminate.

Doc from reactor.netty5.http.client.HttpClientForm.cleanOnTerminate.

Should file attributes be cleaned and eventually removed from disk. Default to false.

Parameters
clean:boolean

true if cleaned on termination (successful or failed)

Returns:HttpClientForm

this builder

Annotations
@Override
encodingback to summary
public HttpClientForm encoding(HttpPostRequestEncoder.EncoderMode mode)

Implements reactor.netty5.http.client.HttpClientForm.encoding.

Doc from reactor.netty5.http.client.HttpClientForm.encoding.

Set Form encoding

Parameters
mode:HttpPostRequestEncoder.EncoderMode

the encoding mode for this form encoding

Returns:HttpClientForm

this builder

Annotations
@Override
factoryback to summary
public HttpClientForm factory(HttpDataFactory factory)

Implements reactor.netty5.http.client.HttpClientForm.factory.

Doc from reactor.netty5.http.client.HttpClientForm.factory.

Set Upload factories (allows memory threshold configuration)

Parameters
factory:HttpDataFactory

the new HttpDataFactory to use

Returns:HttpClientForm

this builder

Annotations
@Override
fileback to summary
public HttpClientForm file(String name, File file)

Implements reactor.netty5.http.client.HttpClientForm.file.

Doc from reactor.netty5.http.client.HttpClientForm.file.

Add an HTTP File Upload attribute

Parameters
name:String

File name

file:File

File reference

Returns:HttpClientForm

this builder

Annotations
@Override
fileback to summary
public HttpClientForm file(String name, InputStream inputStream)

Implements reactor.netty5.http.client.HttpClientForm.file.

Doc from reactor.netty5.http.client.HttpClientForm.file.

Add an HTTP File Upload attribute

Parameters
name:String

File name

inputStream:InputStream

File content as InputStream

Returns:HttpClientForm

this builder

Annotations
@Override
fileback to summary
public HttpClientForm file(String name, String filename, File file, String contentType)

Implements reactor.netty5.http.client.HttpClientForm.file.

Doc from reactor.netty5.http.client.HttpClientForm.file.

Add an HTTP File Upload attribute

Parameters
name:String

File name

filename:String

File name to override origin name

file:File

File reference

contentType:String

File mime-type

Returns:HttpClientForm

this builder

Annotations
@Override
fileback to summary
public HttpClientForm file(String name, String filename, InputStream stream, String contentType)

Implements reactor.netty5.http.client.HttpClientForm.file.

Doc from reactor.netty5.http.client.HttpClientForm.file.

Add an HTTP File Upload attribute

Parameters
name:String

File name

filename:String

File name to override origin name

stream:InputStream

File content as InputStream

contentType:String

File mime-type

Returns:HttpClientForm

this builder

Annotations
@Override
filesback to summary
public HttpClientForm files(String name, File[] files, String[] contentTypes)

Implements reactor.netty5.http.client.HttpClientForm.files.

Doc from reactor.netty5.http.client.HttpClientForm.files.

Add an HTTP File Upload attribute

Parameters
name:String

File name

files:File[]

File references

contentTypes:String[]

File mime-types in the same order than file references

Returns:HttpClientForm

this builder

Annotations
@Override
filesback to summary
public HttpClientForm files(String name, File[] files, String[] contentTypes, boolean[] textFiles)

Implements reactor.netty5.http.client.HttpClientForm.files.

Doc from reactor.netty5.http.client.HttpClientForm.files.

Add an HTTP File Upload attribute

Parameters
name:String

File name

files:File[]

File references

contentTypes:String[]

File mime-type in the same order than file references

textFiles:boolean[]

Plain-Text transmission in the same order than file references

Returns:HttpClientForm

this builder

Annotations
@Override
multipartback to summary
public HttpClientForm multipart(boolean isMultipart)

Implements reactor.netty5.http.client.HttpClientForm.multipart.

Doc from reactor.netty5.http.client.HttpClientForm.multipart.

Define if this request will be encoded as Multipart

Parameters
isMultipart:boolean

should this form be encoded as Multipart

Returns:HttpClientForm

this builder

Annotations
@Override
readChunkback to summary
public HttpContent<?> readChunk(BufferAllocator allocator) throws Exception

Overrides io.netty.contrib.handler.codec.http.multipart.HttpPostRequestEncoder.readChunk.

Implements io.netty5.handler.stream.ChunkedInput.readChunk.

Doc from io.netty5.handler.stream.ChunkedInput.readChunk.

Fetches a chunked data from the stream. Once this method returns the last chunk and thus the stream has reached at its end, any subsequent isEndOfInput() call must return true.

Parameters
allocator:BufferAllocator

BufferAllocator if buffer allocation is necessary.

Returns:HttpContent<?>

the fetched chunk. null if there is no data left in the stream. Please note that null does not necessarily mean that the stream has reached at its end. In a slow stream, the next chunk might be unavailable just momentarily.

Annotations
@Override
runback to summary
public void run()

Implements java.lang.Runnable.run.

Doc from java.lang.Runnable.run.

Runs this operation.

Annotations
@Override
textFileback to summary
public HttpClientForm textFile(String name, File file)

Implements reactor.netty5.http.client.HttpClientForm.textFile.

Doc from reactor.netty5.http.client.HttpClientForm.textFile.

Add an HTTP File Upload attribute for a text file.

Parameters
name:String

Text file name

file:File

Text File reference

Returns:HttpClientForm

this builder

Annotations
@Override
textFileback to summary
public HttpClientForm textFile(String name, File file, String contentType)

Implements reactor.netty5.http.client.HttpClientForm.textFile.

Doc from reactor.netty5.http.client.HttpClientForm.textFile.

Add an HTTP File Upload attribute for a text file.

Parameters
name:String

Text file name

file:File

Text File reference

contentType:String

Text file mime-type

Returns:HttpClientForm

this builder

Annotations
@Override
textFileback to summary
public HttpClientForm textFile(String name, InputStream stream)

Implements reactor.netty5.http.client.HttpClientForm.textFile.

Doc from reactor.netty5.http.client.HttpClientForm.textFile.

Add an HTTP File Upload attribute for a text file.

Parameters
name:String

Text file name

stream:InputStream

Text file content as InputStream

Returns:HttpClientForm

this builder

Annotations
@Override
textFileback to summary
public HttpClientForm textFile(String name, InputStream stream, String contentType)

Implements reactor.netty5.http.client.HttpClientForm.textFile.

Doc from reactor.netty5.http.client.HttpClientForm.textFile.

Add an HTTP File Upload attribute for a text file.

Parameters
name:String

Text file name

stream:InputStream

Text file content as InputStream

contentType:String

Text file mime-type

Returns:HttpClientForm

this builder

Annotations
@Override