use of org.springframework.web.bind.annotation.CookieValue in project spring-framework by spring-projects.
the class AbstractCookieValueMethodArgumentResolver method createNamedValueInfo.
@Override
protected NamedValueInfo createNamedValueInfo(MethodParameter parameter) {
CookieValue annotation = parameter.getParameterAnnotation(CookieValue.class);
Assert.state(annotation != null, "No CookieValue annotation");
return new CookieValueNamedValueInfo(annotation);
}
use of org.springframework.web.bind.annotation.CookieValue in project spring-framework by spring-projects.
the class CookieValueMethodArgumentResolver method createNamedValueInfo.
@Override
protected NamedValueInfo createNamedValueInfo(MethodParameter parameter) {
CookieValue ann = parameter.getParameterAnnotation(CookieValue.class);
Assert.state(ann != null, "No CookieValue annotation");
return new CookieValueNamedValueInfo(ann);
}
use of org.springframework.web.bind.annotation.CookieValue in project mica2 by obiba.
the class SignController method signup.
@GetMapping("/signup")
public ModelAndView signup(HttpServletRequest request, @RequestParam(value = "redirect", required = false) String redirect, @CookieValue(value = "NG_TRANSLATE_LANG_KEY", required = false, defaultValue = "en") String locale, @RequestParam(value = "language", required = false) String language) {
if (!micaConfigService.getConfig().isSignupEnabled())
return new ModelAndView("redirect:" + micaConfigService.getContextPath() + "/");
ModelAndView mv = new ModelAndView("signup");
String lang = getLang(locale, language);
List<OidcProvider> providers = getOidcProviders(lang, true).stream().map(o -> new OidcProvider(o, getOidcSignupUrl(o.getName(), request, redirect))).collect(Collectors.toList());
mv.getModel().put("oidcProviders", providers);
mv.getModel().put("authConfig", getAuthConfiguration());
return mv;
}
use of org.springframework.web.bind.annotation.CookieValue in project com.revolsys.open by revolsys.
the class WebMethodHandler method cookie.
public static WebParameterHandler cookie(final WebAnnotationMethodHandlerAdapter adapter, final Parameter parameter, final Annotation annotation) {
final Class<?> parameterClass = parameter.getType();
final DataType dataType = DataTypes.getDataType(parameterClass);
final CookieValue cookieValue = (CookieValue) annotation;
final String name = getName(parameter, cookieValue.value());
final boolean required = cookieValue.required();
final Object defaultValue = parseDefaultValueAttribute(dataType, cookieValue.defaultValue());
BiFunction<HttpServletRequest, HttpServletResponse, Object> function;
if (Cookie.class.equals(parameterClass)) {
function = (request, response) -> {
final Cookie cookie = WebUtils.getCookie(request, name);
return cookie;
};
} else {
function = (request, response) -> {
final Cookie cookie = WebUtils.getCookie(request, name);
if (cookie == null) {
return null;
} else {
return cookie.getValue();
}
};
}
return //
WebParameterHandler.function(//
name, //
function, //
dataType, //
required, //
defaultValue);
}
use of org.springframework.web.bind.annotation.CookieValue in project mica2 by obiba.
the class SignController method signin.
@GetMapping("/signin")
public ModelAndView signin(HttpServletRequest request, @RequestParam(value = "redirect", required = false) String redirect, @CookieValue(value = "NG_TRANSLATE_LANG_KEY", required = false, defaultValue = "en") String locale, @RequestParam(value = "language", required = false) String language) {
ModelAndView mv = new ModelAndView("signin");
String lang = getLang(locale, language);
List<OidcProvider> providers = getOidcProviders(lang, false).stream().map(o -> new OidcProvider(o, getOidcSigninUrl(o.getName(), request, redirect))).collect(Collectors.toList());
mv.getModel().put("oidcProviders", providers);
return mv;
}
Aggregations