public class SynchronossPartHttpMessageReader extends LoggingCodecSupport implements HttpMessageReader<Part>
HttpMessageReader
for parsing "multipart/form-data"
requests
to a stream of Part
's using the Synchronoss NIO Multipart library.
This reader can be provided to MultipartHttpMessageReader
in order
to aggregate all parts into a Map.
MultipartHttpMessageReader
logger
Constructor and Description |
---|
SynchronossPartHttpMessageReader() |
Modifier and Type | Method and Description |
---|---|
boolean |
canRead(ResolvableType elementType,
MediaType mediaType)
Whether the given object type is supported by this reader.
|
long |
getMaxDiskUsagePerPart()
Get the
configured maximum disk usage. |
int |
getMaxInMemorySize()
Get the
configured maximum in-memory size. |
int |
getMaxParts()
Return the
configured limit on the number of parts. |
List<MediaType> |
getReadableMediaTypes()
Return the list of media types supported by this reader.
|
reactor.core.publisher.Flux<Part> |
read(ResolvableType elementType,
ReactiveHttpInputMessage message,
Map<String,Object> hints)
Read from the input message and decode to a stream of objects.
|
reactor.core.publisher.Mono<Part> |
readMono(ResolvableType elementType,
ReactiveHttpInputMessage message,
Map<String,Object> hints)
Read from the input message and decode to a single object.
|
void |
setFileStorageDirectory(Path fileStorageDirectory)
Set the directory used to store parts larger than
maxInMemorySize . |
void |
setMaxDiskUsagePerPart(long maxDiskUsagePerPart)
Configure the maximum amount of disk space allowed for file parts.
|
void |
setMaxInMemorySize(int byteCount)
Configure the maximum amount of memory that is allowed to use per part.
|
void |
setMaxParts(int maxParts)
Specify the maximum number of parts allowed in a given multipart request.
|
isEnableLoggingRequestDetails, setEnableLoggingRequestDetails
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getReadableMediaTypes, read, readMono
public void setMaxInMemorySize(int byteCount)
DataBufferLimitException
.
By default this is set to 256K.
byteCount
- the in-memory limit in bytes; if set to -1 this limit is
not enforced, and all parts may be written to disk and are limited only
by the maxDiskUsagePerPart
property.public int getMaxInMemorySize()
configured
maximum in-memory size.public void setMaxDiskUsagePerPart(long maxDiskUsagePerPart)
By default this is set to -1.
maxDiskUsagePerPart
- the disk limit in bytes, or -1 for unlimitedpublic long getMaxDiskUsagePerPart()
configured
maximum disk usage.public void setMaxParts(int maxParts)
public int getMaxParts()
configured
limit on the number of parts.public void setFileStorageDirectory(Path fileStorageDirectory) throws IOException
maxInMemorySize
. By default, a new
temporary directory is created.IOException
- if an I/O error occurs, or the parent directory
does not existpublic List<MediaType> getReadableMediaTypes()
HttpMessageReader
canWrite(elementType, null)
. The list may also exclude media types
supported only for a specific element type. Alternatively, use
HttpMessageReader.getReadableMediaTypes(ResolvableType)
for a more precise list.getReadableMediaTypes
in interface HttpMessageReader<Part>
public boolean canRead(ResolvableType elementType, @Nullable MediaType mediaType)
HttpMessageReader
canRead
in interface HttpMessageReader<Part>
elementType
- the type of object to checkmediaType
- the media type for the read (possibly null
)true
if readable, false
otherwisepublic reactor.core.publisher.Flux<Part> read(ResolvableType elementType, ReactiveHttpInputMessage message, Map<String,Object> hints)
HttpMessageReader
read
in interface HttpMessageReader<Part>
elementType
- the type of objects in the stream which must have been
previously checked via HttpMessageReader.canRead(ResolvableType, MediaType)
message
- the message to read fromhints
- additional information about how to read and decode the inputpublic reactor.core.publisher.Mono<Part> readMono(ResolvableType elementType, ReactiveHttpInputMessage message, Map<String,Object> hints)
HttpMessageReader
readMono
in interface HttpMessageReader<Part>
elementType
- the type of objects in the stream which must have been
previously checked via HttpMessageReader.canRead(ResolvableType, MediaType)
message
- the message to read fromhints
- additional information about how to read and decode the input