1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| import javax.servlet.http.HttpServletRequest;
import org.springframework.core.MethodParameter; import org.springframework.web.bind.support.WebDataBinderFactory; import org.springframework.web.context.request.NativeWebRequest; import org.springframework.web.method.support.HandlerMethodArgumentResolver; import org.springframework.web.method.support.ModelAndViewContainer;
import lombok.extern.slf4j.Slf4j; import summer.webserver.util.SummerUtils;
@Slf4j public class SummerArgumentResolver implements HandlerMethodArgumentResolver {
public SummerArgumentResolver() { super(); }
@Override public boolean supportsParameter(MethodParameter parameter) { return SummerHeader.class.isAssignableFrom(parameter.getParameterType()); }
@Override public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) { return SummerUtils.getSummerHeader(webRequest.getNativeRequest(HttpServletRequest.class)); } }
|