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>
HttpMessageReaderfor parsing"multipart/form-data"requests to a stream ofPart's using the Synchronoss NIO Multipart library.This reader can be provided to
MultipartHttpMessageReaderin 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 booleancanRead(ResolvableType elementType, MediaType mediaType)Whether the given object type is supported by this reader.longgetMaxDiskUsagePerPart()Get theconfiguredmaximum disk usage.intgetMaxInMemorySize()Get theconfiguredmaximum in-memory size.intgetMaxParts()Return theconfiguredlimit 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.voidsetMaxDiskUsagePerPart(long maxDiskUsagePerPart)Configure the maximum amount of disk space allowed for file parts.voidsetMaxInMemorySize(int byteCount)Configure the maximum amount of memory that is allowed to use per part.voidsetMaxParts(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 themaxDiskUsagePerPartproperty.- Since:
- 5.1.11
getMaxInMemorySize
public int getMaxInMemorySize()
Get theconfiguredmaximum 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 theconfiguredmaximum 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 theconfiguredlimit on the number of parts.- Since:
- 5.1.11
getReadableMediaTypes
public List<MediaType> getReadableMediaTypes()
Description copied from interface:HttpMessageReaderReturn theMediaType's that this reader supports.- Specified by:
getReadableMediaTypesin interfaceHttpMessageReader<Part>
canRead
public boolean canRead(ResolvableType elementType, @Nullable MediaType mediaType)
Description copied from interface:HttpMessageReaderWhether the given object type is supported by this reader.- Specified by:
canReadin interfaceHttpMessageReader<Part>- Parameters:
elementType- the type of object to checkmediaType- the media type for the read (possiblynull)- Returns:
trueif readable,falseotherwise
read
public reactor.core.publisher.Flux<Part> read(ResolvableType elementType, ReactiveHttpInputMessage message, Map<String,Object> hints)
Description copied from interface:HttpMessageReaderRead from the input message and encode to a stream of objects.- Specified by:
readin 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:HttpMessageReaderRead from the input message and encode to a single object.- Specified by:
readMonoin 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