Top Description Fields Constructors Methods
org.springframework.http.codec.multipart

public Class PartHttpMessageWriter

extends MultipartWriterSupport
implements HttpMessageWriter<Part>
Class Inheritance
All Implemented Interfaces
org.springframework.http.codec.HttpMessageWriter
Imports
java.util.Map, org.reactivestreams.Publisher, reactor.core.publisher.Flux, .Mono, org.springframework.core.ResolvableType, org.springframework.core.codec.Hints, org.springframework.core.io.buffer.DataBuffer, .DataBufferFactory, .DataBufferUtils, org.springframework.http.HttpHeaders, .MediaType, .ReactiveHttpOutputMessage, org.springframework.http.codec.HttpMessageWriter, org.springframework.lang.Nullable

HttpMessageWriter for writing with Part. This can be useful on the server side to write a Flux<Part> received from a client to some remote service.
Author
Rossen Stoyanchev
Since
5.3

Field Summary

Inherited from org.springframework.http.codec.multipart.MultipartWriterSupport:
DEFAULT_CHARSET

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
canWrite(ResolvableType
the type of object to check
elementType
,
MediaType
the media type for the write (possibly null)
mediaType
)

Implements org.springframework.http.codec.HttpMessageWriter.canWrite.

Whether the given object type is supported by this writer.

private <T> Flux<DataBuffer>
encodePart(byte[] boundary, Part part, DataBufferFactory bufferFactory)

public Mono<Void>
write(Publisher<? extends Part>
the objects to write
parts
,
ResolvableType
the type of objects in the stream which must have been previously checked via canWrite(ResolvableType, MediaType)
elementType
,
MediaType
the content type for the write (possibly null to indicate that the default content type of the writer must be used)
mediaType
,
ReactiveHttpOutputMessage
the message to write to
outputMessage
,
Map<String, Object>
additional information about how to encode and write
hints
)

Implements org.springframework.http.codec.HttpMessageWriter.write.

Write a given stream of object to the output message.

Inherited from org.springframework.http.codec.multipart.MultipartWriterSupport:
generateBoundaryLinegenerateLastLinegenerateMultipartBoundarygenerateNewLinegeneratePartHeadersgetCharsetgetMultipartMediaTypegetWritableMediaTypessetCharset

Constructor Detail

PartHttpMessageWriterback to summary
public PartHttpMessageWriter()

Method Detail

canWriteback to summary
public boolean canWrite(ResolvableType elementType, MediaType mediaType)

Implements org.springframework.http.codec.HttpMessageWriter.canWrite.

Doc from org.springframework.http.codec.HttpMessageWriter.canWrite.

Whether the given object type is supported by this writer.

Parameters
elementType:ResolvableType

the type of object to check

mediaType:MediaType

the media type for the write (possibly null)

Returns:boolean

true if writable, false otherwise

Annotations
@Override
encodePartback to summary
private <T> Flux<DataBuffer> encodePart(byte[] boundary, Part part, DataBufferFactory bufferFactory)
writeback to summary
public Mono<Void> write(Publisher<? extends Part> parts, ResolvableType elementType, MediaType mediaType, ReactiveHttpOutputMessage outputMessage, Map<String, Object> hints)

Implements org.springframework.http.codec.HttpMessageWriter.write.

Doc from org.springframework.http.codec.HttpMessageWriter.write.

Write a given stream of object to the output message.

Parameters
parts:Publisher<? extends Part>

the objects to write

elementType:ResolvableType

the type of objects in the stream which must have been previously checked via canWrite(ResolvableType, MediaType)

mediaType:MediaType

the content type for the write (possibly null to indicate that the default content type of the writer must be used)

outputMessage:ReactiveHttpOutputMessage

the message to write to

hints:Map<String, Object>

additional information about how to encode and write

Returns:Mono<Void>

indicates completion or error

Annotations
@Override