60
60
import org .springframework .util .CollectionUtils ;
61
61
import org .springframework .validation .BindingResult ;
62
62
import org .springframework .validation .Errors ;
63
+ import org .springframework .web .bind .annotation .CookieValue ;
63
64
import org .springframework .web .bind .annotation .PathVariable ;
64
65
import org .springframework .web .bind .annotation .RequestAttribute ;
65
66
import org .springframework .web .bind .annotation .RequestHeader ;
@@ -258,6 +259,8 @@ private Parameter buildParams(ParameterInfo parameterInfo, Components components
258
259
RequestParam .class );
259
260
PathVariable pathVar = parameterBuilder .getParameterAnnotation (handlerMethod , parameters , index ,
260
261
PathVariable .class );
262
+ CookieValue cookieValue = parameterBuilder .getParameterAnnotation (handlerMethod , parameters , index ,
263
+ CookieValue .class );
261
264
262
265
Parameter parameter = null ;
263
266
RequestInfo requestInfo ;
@@ -281,6 +284,10 @@ else if (pathVar != null) {
281
284
// check if PATH PARAM
282
285
requestInfo = new RequestInfo (ParameterType .PATH_PARAM , pathVar .value (), Boolean .TRUE , null );
283
286
parameter = buildParam (parameterInfo , components , requestInfo , jsonView );
287
+ } else if (cookieValue != null ) {
288
+ requestInfo = new RequestInfo (ParameterType .COOKIE , cookieValue .value (), cookieValue .required (),
289
+ cookieValue .defaultValue ());
290
+ parameter = buildParam (parameterInfo , components , requestInfo , jsonView );
284
291
}
285
292
// By default
286
293
if (RequestMethod .GET .equals (requestMethod ) || (parameterInfo .getParameterModel () != null && ParameterIn .PATH .toString ().equals (parameterInfo .getParameterModel ().getIn ()))) {
0 commit comments