Top Description Inners Fields Constructors Methods
org.springframework.messaging.handler.annotation.support

public Class HeaderMethodArgumentResolver

extends AbstractNamedValueMethodArgumentResolver
Class Inheritance
Imports
java.util.List, .Map, org.apache.commons.logging.Log, .LogFactory, org.springframework.beans.factory.config.ConfigurableBeanFactory, org.springframework.core.MethodParameter, org.springframework.core.convert.ConversionService, org.springframework.lang.Nullable, org.springframework.messaging.Message, .MessageHandlingException, org.springframework.messaging.handler.annotation.Header, org.springframework.messaging.support.NativeMessageHeaderAccessor, org.springframework.util.Assert

Resolver for @Header arguments. Headers are resolved from either the top-level header map or the nested native header map.
Author
Rossen Stoyanchev
Since
4.0
See Also
HeadersMethodArgumentResolver, NativeMessageHeaderAccessor

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private static final Log

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected AbstractNamedValueMethodArgumentResolver.NamedValueInfo
private Map<String, List<String>>
private Object
protected void
handleMissingValue(String
the name for the value
headerName
,
MethodParameter
the target method parameter
parameter
,
Message<?>
the message being processed
message
)

Implements abstract org.springframework.messaging.handler.annotation.support.AbstractNamedValueMethodArgumentResolver.handleMissingValue.

Invoked when a value is required, but resolveArgumentInternal returned null and there is no default value.

protected Object
resolveArgumentInternal(MethodParameter
the method parameter to resolve to an argument value
parameter
,
Message<?>
the current request
message
,
String
the name of the value being resolved
name
)

Implements abstract org.springframework.messaging.handler.annotation.support.AbstractNamedValueMethodArgumentResolver.resolveArgumentInternal.

Resolves the given parameter type and value name into an argument value.

public boolean
supportsParameter(MethodParameter
the method parameter to check
parameter
)

Implements org.springframework.messaging.handler.invocation.HandlerMethodArgumentResolver.supportsParameter.

Whether the given method parameter is supported by this resolver.

Inherited from org.springframework.messaging.handler.annotation.support.AbstractNamedValueMethodArgumentResolver:
handleResolvedValueresolveArgument

Field Detail

loggerback to summary
private static final Log logger

Constructor Detail

HeaderMethodArgumentResolverback to summary
public HeaderMethodArgumentResolver(ConversionService conversionService, ConfigurableBeanFactory beanFactory)

Method Detail

createNamedValueInfoback to summary
protected AbstractNamedValueMethodArgumentResolver.NamedValueInfo createNamedValueInfo(MethodParameter parameter)

Implements abstract org.springframework.messaging.handler.annotation.support.AbstractNamedValueMethodArgumentResolver.createNamedValueInfo.

Doc from org.springframework.messaging.handler.annotation.support.AbstractNamedValueMethodArgumentResolver.createNamedValueInfo.

Create the NamedValueInfo object for the given method parameter. Implementations typically retrieve the method annotation by means of MethodParameter#getParameterAnnotation(Class).

Parameters
parameter:MethodParameter

the method parameter

Returns:AbstractNamedValueMethodArgumentResolver.NamedValueInfo

the named value information

Annotations
@Override
getNativeHeadersback to summary
private Map<String, List<String>> getNativeHeaders(Message<?> message)
Annotations
@SuppressWarnings:unchecked
@Nullable
getNativeHeaderValueback to summary
private Object getNativeHeaderValue(Message<?> message, String name)
Annotations
@Nullable
handleMissingValueback to summary
protected void handleMissingValue(String headerName, MethodParameter parameter, Message<?> message)

Implements abstract org.springframework.messaging.handler.annotation.support.AbstractNamedValueMethodArgumentResolver.handleMissingValue.

Doc from org.springframework.messaging.handler.annotation.support.AbstractNamedValueMethodArgumentResolver.handleMissingValue.

Invoked when a value is required, but resolveArgumentInternal returned null and there is no default value. Subclasses can throw an appropriate exception for this case.

Parameters
headerName:String

the name for the value

parameter:MethodParameter

the target method parameter

message:Message<?>

the message being processed

Annotations
@Override
resolveArgumentInternalback to summary
protected Object resolveArgumentInternal(MethodParameter parameter, Message<?> message, String name) throws Exception

Implements abstract org.springframework.messaging.handler.annotation.support.AbstractNamedValueMethodArgumentResolver.resolveArgumentInternal.

Doc from org.springframework.messaging.handler.annotation.support.AbstractNamedValueMethodArgumentResolver.resolveArgumentInternal.

Resolves the given parameter type and value name into an argument value.

Parameters
parameter:MethodParameter

the method parameter to resolve to an argument value

message:Message<?>

the current request

name:String

the name of the value being resolved

Returns:Object

the resolved argument. May be null

Annotations
@Override
@Nullable
Exceptions
Exception:
in case of errors
supportsParameterback to summary
public boolean supportsParameter(MethodParameter parameter)

Implements org.springframework.messaging.handler.invocation.HandlerMethodArgumentResolver.supportsParameter.

Doc from org.springframework.messaging.handler.invocation.HandlerMethodArgumentResolver.supportsParameter.

Whether the given method parameter is supported by this resolver.

Parameters
parameter:MethodParameter

the method parameter to check

Returns:boolean

true if this resolver supports the supplied parameter; false otherwise

Annotations
@Override
org.springframework.messaging.handler.annotation.support back to summary

private final Class HeaderMethodArgumentResolver.HeaderNamedValueInfo

extends NamedValueInfo
Class Inheritance

Constructor Summary

AccessConstructor and Description
private

Constructor Detail

HeaderNamedValueInfoback to summary
private HeaderNamedValueInfo(Header annotation)