@Target(value=PARAMETER) @Retention(value=RUNTIME) @Documented public @interface CookieValue
The method parameter may be declared as type Cookie
or as cookie value type (String, int, etc).
RequestMapping,
RequestParam,
RequestHeader,
RequestMapping,
RequestMappingHandlerAdapter,
AnnotationMethodHandlerAdapter,
AnnotationMethodHandlerAdapter| Modifier and Type | Optional Element and Description |
|---|---|
String |
defaultValue
The default value to use as a fallback.
|
boolean |
required
Whether the header is required.
|
String |
value
The name of the cookie to bind to.
|
public abstract String value
public abstract boolean required
Default is true, leading to an exception being thrown
in case the header is missing in the request. Switch this to
false if you prefer a null in case of the
missing header.
Alternatively, provide a defaultValue(), which implicitly sets
this flag to false.
public abstract String defaultValue
required() to false.