Class SynchronossPartHttpMessageReader
- java.lang.Object
- org.springframework.http.codec.LoggingCodecSupport
- org.springframework.http.codec.multipart.SynchronossPartHttpMessageReader
- All Implemented Interfaces:
HttpMessageReader<Part>
public class SynchronossPartHttpMessageReader extends LoggingCodecSupport implements HttpMessageReader<Part>
HttpMessageReader
for parsing"multipart/form-data"
requests to a stream ofPart
's using the Synchronoss NIO Multipart library.This reader can be provided to
MultipartHttpMessageReader
in order to aggregate all parts into a Map.- Since:
- 5.0
- Author:
- Sebastien Deleuze, Rossen Stoyanchev, Arjen Poutsma, Brian Clozel
- See Also:
- Synchronoss NIO Multipart,
MultipartHttpMessageReader
Field Summary
Fields inherited from class org.springframework.http.codec.LoggingCodecSupport
logger
Constructor Summary
Constructors Constructor Description SynchronossPartHttpMessageReader()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canRead(ResolvableType elementType, MediaType mediaType)
Whether the given object type is supported by this reader.long
getMaxDiskUsagePerPart()
Get theconfigured
maximum disk usage.int
getMaxInMemorySize()
Get theconfigured
maximum in-memory size.int
getMaxParts()
Return theconfigured
limit on the number of parts.List<MediaType>
getReadableMediaTypes()
Return theMediaType
's that this reader supports.reactor.core.publisher.Flux<Part>
read(ResolvableType elementType, ReactiveHttpInputMessage message, Map<String,Object> hints)
Read from the input message and encode 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 encode to a single object.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.Methods inherited from class org.springframework.http.codec.LoggingCodecSupport
isEnableLoggingRequestDetails, setEnableLoggingRequestDetails
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.http.codec.HttpMessageReader
read, readMono
Constructor Detail
SynchronossPartHttpMessageReader
public SynchronossPartHttpMessageReader()
Method Detail
setMaxInMemorySize
public void setMaxInMemorySize(int byteCount)
Configure the maximum amount of memory that is allowed to use per part. When the limit is exceeded:- file parts are written to a temporary file.
- non-file parts are rejected with
DataBufferLimitException
.
By default this is set to 256K.
- Parameters:
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 themaxDiskUsagePerPart
property.- Since:
- 5.1.11
getMaxInMemorySize
public int getMaxInMemorySize()
Get theconfigured
maximum in-memory size.- Since:
- 5.1.11
setMaxDiskUsagePerPart
public void setMaxDiskUsagePerPart(long maxDiskUsagePerPart)
Configure the maximum amount of disk space allowed for file parts.By default this is set to -1.
- Parameters:
maxDiskUsagePerPart
- the disk limit in bytes, or -1 for unlimited- Since:
- 5.1.11
getMaxDiskUsagePerPart
public long getMaxDiskUsagePerPart()
Get theconfigured
maximum disk usage.- Since:
- 5.1.11
setMaxParts
public void setMaxParts(int maxParts)
Specify the maximum number of parts allowed in a given multipart request.- Since:
- 5.1.11
getMaxParts
public int getMaxParts()
Return theconfigured
limit on the number of parts.- Since:
- 5.1.11
getReadableMediaTypes
public List<MediaType> getReadableMediaTypes()
Description copied from interface:HttpMessageReader
Return theMediaType
's that this reader supports.- Specified by:
getReadableMediaTypes
in interfaceHttpMessageReader<Part>
canRead
public boolean canRead(ResolvableType elementType, @Nullable MediaType mediaType)
Description copied from interface:HttpMessageReader
Whether the given object type is supported by this reader.- Specified by:
canRead
in interfaceHttpMessageReader<Part>
- Parameters:
elementType
- the type of object to checkmediaType
- the media type for the read (possiblynull
)- Returns:
true
if readable,false
otherwise
read
public reactor.core.publisher.Flux<Part> read(ResolvableType elementType, ReactiveHttpInputMessage message, Map<String,Object> hints)
Description copied from interface:HttpMessageReader
Read from the input message and encode to a stream of objects.- Specified by:
read
in interfaceHttpMessageReader<Part>
- Parameters:
elementType
- the type of objects in the stream which must have been previously checked viaHttpMessageReader.canRead(ResolvableType, MediaType)
message
- the message to read fromhints
- additional information about how to read and decode the input- Returns:
- the decoded stream of elements
readMono
public reactor.core.publisher.Mono<Part> readMono(ResolvableType elementType, ReactiveHttpInputMessage message, Map<String,Object> hints)
Description copied from interface:HttpMessageReader
Read from the input message and encode to a single object.- Specified by:
readMono
in interfaceHttpMessageReader<Part>
- Parameters:
elementType
- the type of objects in the stream which must have been previously checked viaHttpMessageReader.canRead(ResolvableType, MediaType)
message
- the message to read fromhints
- additional information about how to read and decode the input- Returns:
- the decoded object