Add support for resolving message headers

This change adds support for @Header and @Headers annotated method
arguments to spring-messaging. Also supported are arguments of type
MessageHeaders, and MessageHeaderAccessor (including sub-types of
MessageHeaderAccessort as long as they provide a wrap(Message<?>)
static factory method).

This change also renames @MessageBody to @Payload.

Issue: SPR-10985
This commit is contained in:
Rossen Stoyanchev
2013-10-13 11:04:22 -04:00
parent ca9df4d2ef
commit 8ae88c20d1
18 changed files with 1155 additions and 112 deletions

View File

@@ -16,12 +16,6 @@
package org.springframework.web.method.annotation;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.lang.reflect.Method;
import java.util.Map;
@@ -37,7 +31,8 @@ import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletWebRequest;
import org.springframework.web.context.support.GenericWebApplicationContext;
import org.springframework.web.method.annotation.RequestHeaderMethodArgumentResolver;
import static org.junit.Assert.*;
/**
* Test fixture with {@link org.springframework.web.method.annotation.RequestHeaderMethodArgumentResolver}.
@@ -143,7 +138,6 @@ public class RequestHeaderMethodArgumentResolverTests {
@Test(expected = ServletRequestBindingException.class)
public void notFound() throws Exception {
resolver.resolveArgument(paramNamedValueStringArray, null, webRequest, null);
fail("Expected exception");
}
public void params(@RequestHeader(value = "name", defaultValue = "bar") String param1,