private static Object processCookieParam(Message m, String cookieName,
Class<?> pClass, Type genericType,
Annotation[] paramAnns, String defaultValue) {
Cookie c = new HttpHeadersImpl(m).getCookies().get(cookieName);
if (c == null && defaultValue != null) {
c = Cookie.valueOf(cookieName + '=' + defaultValue);
}
if (c == null) {
return null;
}
if (pClass.isAssignableFrom(Cookie.class)) {
return c;
}
String value = InjectionUtils.isSupportedCollectionOrArray(pClass)
&& InjectionUtils.getActualType(genericType) == Cookie.class
? c.toString() : c.getValue();
return InjectionUtils.createParameterObject(Collections.singletonList(value),
pClass,
genericType,
paramAnns,
null,
false,
ParameterType.COOKIE,
m);
}