@MatrixVariable resolvers for WebFlux
The information was already parsed and available in a request attribute but until now there were no argument resolvers to expose it. Issue: SPR-16005
This commit is contained in:
@@ -38,9 +38,13 @@ import org.springframework.web.method.support.ModelAndViewContainer;
|
||||
import org.springframework.web.servlet.HandlerMapping;
|
||||
|
||||
/**
|
||||
* Resolves method arguments of type Map annotated with
|
||||
* {@link MatrixVariable @MatrixVariable} where the annotation does not
|
||||
* specify a name. If a name is specified then the argument will by resolved by the
|
||||
* Resolves arguments of type {@link Map} annotated with {@link MatrixVariable
|
||||
* @MatrixVariable} where the annotation does not specify a name. In other words
|
||||
* the purpose of this resolver is to provide access to multiple matrix
|
||||
* variables, either all or associted with a specific path variable.
|
||||
*
|
||||
* <p>When a name is specified, an argument of type Map is considered to be an
|
||||
* single attribute with a Map value, and is resolved by
|
||||
* {@link MatrixVariableMethodArgumentResolver} instead.
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
@@ -48,6 +52,7 @@ import org.springframework.web.servlet.HandlerMapping;
|
||||
*/
|
||||
public class MatrixVariableMapMethodArgumentResolver implements HandlerMethodArgumentResolver {
|
||||
|
||||
|
||||
@Override
|
||||
public boolean supportsParameter(MethodParameter parameter) {
|
||||
MatrixVariable matrixVariable = parameter.getParameterAnnotation(MatrixVariable.class);
|
||||
|
||||
@@ -35,10 +35,12 @@ import org.springframework.web.method.annotation.AbstractNamedValueMethodArgumen
|
||||
import org.springframework.web.servlet.HandlerMapping;
|
||||
|
||||
/**
|
||||
* Resolves method arguments annotated with {@link MatrixVariable @MatrixVariable}.
|
||||
* Resolves arguments annotated with {@link MatrixVariable @MatrixVariable}.
|
||||
*
|
||||
* <p>If the method parameter is of type Map and no name is specified, then it will
|
||||
* by resolved by the {@link MatrixVariableMapMethodArgumentResolver} instead.
|
||||
* <p>If the method parameter is of type {@link Map} it will by resolved by
|
||||
* {@link MatrixVariableMapMethodArgumentResolver} instead unless the annotation
|
||||
* specifies a name in which case it is considered to be a single attribute of
|
||||
* type map (vs multiple attributes collected in a map).
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
* @author Sam Brannen
|
||||
|
||||
Reference in New Issue
Block a user