Top Description Inners Constructors Methods
org.springframework.web.reactive.result.method.annotation

public Class RequestPartMethodArgumentResolver

extends AbstractMessageReaderArgumentResolver
Class Inheritance
Imports
java.util.Collection, .Collections, .List, reactor.core.publisher.Flux, .Mono, org.springframework.core.MethodParameter, .ReactiveAdapter, .ReactiveAdapterRegistry, org.springframework.core.io.buffer.DataBuffer, org.springframework.http.HttpHeaders, org.springframework.http.codec.HttpMessageReader, org.springframework.http.codec.multipart.Part, org.springframework.http.server.reactive.ServerHttpRequest, .ServerHttpRequestDecorator, org.springframework.lang.Nullable, org.springframework.util.CollectionUtils, .StringUtils, org.springframework.web.bind.annotation.RequestPart, org.springframework.web.reactive.BindingContext, org.springframework.web.server.MissingRequestValueException, .ServerWebExchange

Resolver for @RequestPart arguments where the named part is decoded much like an @RequestBody argument but based on the content of an individual part instead. The arguments may be wrapped with a reactive type for a single value (e.g. Reactor Mono, RxJava Single).

This resolver also supports arguments of type Part which may be wrapped with a reactive type for a single value or multiple values.

Author
Rossen Stoyanchev
Since
5.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private <T> Mono<T>
decode(Part part, MethodParameter elementType, BindingContext bindingContext, ServerWebExchange exchange, boolean isRequired)

private String
getPartName(MethodParameter methodParam, RequestPart requestPart)

public Flux<Part>
getPartValues(MethodParameter parameter, RequestPart requestPart, boolean isRequired, ServerWebExchange exchange)

public Mono<Object>
resolveArgument(MethodParameter
the method parameter
parameter
,
BindingContext
the binding context to use
bindingContext
,
ServerWebExchange
the current exchange
exchange
)

Implements org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver.resolveArgument.

Resolve the value for the method parameter.

public boolean
supportsParameter(MethodParameter
the method parameter
parameter
)

Implements org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver.supportsParameter.

Whether this resolver supports the given method parameter.

Inherited from org.springframework.web.reactive.result.method.annotation.AbstractMessageReaderArgumentResolver:
getMessageReadersreadBodyreadBody

Constructor Detail

RequestPartMethodArgumentResolverback to summary
public RequestPartMethodArgumentResolver(List<HttpMessageReader<?>> readers, ReactiveAdapterRegistry registry)

Method Detail

decodeback to summary
private <T> Mono<T> decode(Part part, MethodParameter elementType, BindingContext bindingContext, ServerWebExchange exchange, boolean isRequired)
Annotations
@SuppressWarnings:unchecked
getPartNameback to summary
private String getPartName(MethodParameter methodParam, RequestPart requestPart)
getPartValuesback to summary
public Flux<Part> getPartValues(MethodParameter parameter, RequestPart requestPart, boolean isRequired, ServerWebExchange exchange)
resolveArgumentback to summary
public Mono<Object> resolveArgument(MethodParameter parameter, BindingContext bindingContext, ServerWebExchange exchange)

Implements org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver.resolveArgument.

Doc from org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver.resolveArgument.

Resolve the value for the method parameter.

Parameters
parameter:MethodParameter

the method parameter

bindingContext:BindingContext

the binding context to use

exchange:ServerWebExchange

the current exchange

Returns:Mono<Object>

Mono for the argument value, possibly empty

Annotations
@Override
supportsParameterback to summary
public boolean supportsParameter(MethodParameter parameter)

Implements org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver.supportsParameter.

Doc from org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver.supportsParameter.

Whether this resolver supports the given method parameter.

Parameters
parameter:MethodParameter

the method parameter

Annotations
@Override
org.springframework.web.reactive.result.method.annotation back to summary

private Class RequestPartMethodArgumentResolver.PartServerHttpRequest

extends ServerHttpRequestDecorator
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final Part

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Flux<DataBuffer>
public HttpHeaders
Inherited from org.springframework.http.server.reactive.ServerHttpRequestDecorator:
getCookiesgetDelegategetIdgetLocalAddressgetMethodgetNativeRequestgetPathgetQueryParamsgetRemoteAddressgetSslInfogetURItoString

Field Detail

partback to summary
private final Part part

Constructor Detail

PartServerHttpRequestback to summary
public PartServerHttpRequest(ServerHttpRequest delegate, Part part)

Method Detail

getBodyback to summary
public Flux<DataBuffer> getBody()

Overrides org.springframework.http.server.reactive.ServerHttpRequestDecorator.getBody.

Implements org.springframework.http.ReactiveHttpInputMessage.getBody.

Doc from org.springframework.http.ReactiveHttpInputMessage.getBody.

Return the body of the message as a Publisher.

Returns:Flux<DataBuffer>

the body content publisher

Annotations
@Override
getHeadersback to summary
public HttpHeaders getHeaders()

Overrides org.springframework.http.server.reactive.ServerHttpRequestDecorator.getHeaders.

Implements org.springframework.http.HttpMessage.getHeaders.

Doc from org.springframework.http.HttpMessage.getHeaders.

Return the headers of this message.

Returns:HttpHeaders

a corresponding HttpHeaders object (never null)

Annotations
@Override