@Override @Nullable protected String getMediaTypeKey(NativeWebRequest request) { return request.getParameter(getParameterName()); }
if (value == null) { if (fieldDefaultPrefix != null) { value = webRequest.getParameter(fieldDefaultPrefix + paramName); if (webRequest.getParameter(fieldMarkerPrefix + paramName) != null) { value = binder.getEmptyValue(paramType);
/** * Obtain a value from the request that may be used to instantiate the * model attribute through type conversion from String to the target type. * <p>The default implementation looks for the attribute name to match * a URI variable first and then a request parameter. * @param attributeName the model attribute name * @param request the current request * @return the request value to try to convert, or {@code null} if none */ @Nullable protected String getRequestValueForAttribute(String attributeName, NativeWebRequest request) { Map<String, String> variables = getUriTemplateVariables(request); String variableValue = variables.get(attributeName); if (StringUtils.hasText(variableValue)) { return variableValue; } String parameterValue = request.getParameter(attributeName); if (StringUtils.hasText(parameterValue)) { return parameterValue; } return null; }
if (value == null) { if (fieldDefaultPrefix != null) { value = webRequest.getParameter(fieldDefaultPrefix + paramName); if (webRequest.getParameter(fieldMarkerPrefix + paramName) != null) { value = binder.getEmptyValue(paramType);
@Override @Nullable protected String getMediaTypeKey(NativeWebRequest request) { return request.getParameter(getParameterName()); }
/** * Obtain a value from the request that may be used to instantiate the * model attribute through type conversion from String to the target type. * <p>The default implementation looks for the attribute name to match * a URI variable first and then a request parameter. * @param attributeName the model attribute name * @param request the current request * @return the request value to try to convert, or {@code null} if none */ @Nullable protected String getRequestValueForAttribute(String attributeName, NativeWebRequest request) { Map<String, String> variables = getUriTemplateVariables(request); String variableValue = variables.get(attributeName); if (StringUtils.hasText(variableValue)) { return variableValue; } String parameterValue = request.getParameter(attributeName); if (StringUtils.hasText(parameterValue)) { return parameterValue; } return null; }
@Override public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception { JsonParam jsonParam = parameter.getParameterAnnotation(JsonParam.class); String object = webRequest.getParameter(jsonParam.value()); if (null != object) { Class type = jsonParam.type() != Void.class ? jsonParam.type() : parameter.getParameterType(); return fastJsonHttpMessageConverter.readByString(type, object); } return null; }
public class UpperCaseResolver implements HandlerMethodArgumentResolver { public boolean supportsParameter(MethodParameter parameter) { return parameter.getParameterAnnotation(UpperCase.class) != null; } public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception { UpperCase attr = parameter.getParameterAnnotation(UpperCase.class); return webRequest.getParameter(attr.value()).toUpperCase(); } }
@Override public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception { String projectionParameter = webRequest.getParameter(projectionDefinitions.getParameterName()); PersistentEntityProjector projector = new PersistentEntityProjector(projectionDefinitions, projectionFactory, projectionParameter, links.getMappings()); return new PersistentEntityResourceAssembler(entities, projector, links, linkProvider); } }
protected String getRequestValueForAttribute(String attributeName, NativeWebRequest request) { Map<String, String> variables = getUriTemplateVariables(request); if (StringUtils.hasText(variables.get(attributeName))) { return variables.get(attributeName); } else if (StringUtils.hasText(request.getParameter(attributeName))) { return request.getParameter(attributeName); } else { return null; } }
protected SkipCountParameter parseSkipCount(NativeWebRequest webRequest) { long skipCount = 0; String skipCountString = webRequest.getParameter("skipCount"); boolean isSet = skipCountString != null; if (isSet) { skipCount = Long.parseLong(skipCountString); } return new SkipCountParameter(isSet, skipCount); }
private void verifyStateParameter(NativeWebRequest request) { String state = request.getParameter("state"); String originalState = extractCachedOAuth2State(request); if (state == null || !state.equals(originalState)) { throw new IllegalStateException("The OAuth2 'state' parameter is missing or doesn't match."); } }
@Override @Nullable protected String getMediaTypeKey(NativeWebRequest request) { return request.getParameter(getParameterName()); }
protected MaxItemsParameter parseMaxItems(NativeWebRequest webRequest) { int maxItems = defaultPageSize; String maxItemsString = webRequest.getParameter("maxItems"); boolean isSet = maxItemsString != null; if (isSet) { maxItems = Integer.parseInt(maxItemsString); } return new MaxItemsParameter(isSet, maxItems); }
public class UserArgumentResolver implements HandlerMethodArgumentResolver { public Object resolveArgument(final MethodParameter parameter, final ModelAndViewContainer container, final NativeWebRequest webRequest, final WebDataBinderFactory binderFactory) { final User user = new User(); user.setUsername(webRequest.getParameter("name")); user.setPassword(webRequest.getParameter("pw")); return user; } }
@Override public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception { String propertyPreFilterName = getFilterName(parameter); String queryFields = webRequest.getParameter(propertyPreFilterName); return new QueryPropertyPreFilter(queryFields); }
@Override public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception { String propertyPreFilterName = getFilterName(parameter); String queryFields = webRequest.getParameter(propertyPreFilterName); return new QueryPropertyPreFilter(queryFields); }
@Override public @Nullable Object resolveArgument( MethodParameter parameter, @Nullable ModelAndViewContainer mavContainer, NativeWebRequest webRequest, @Nullable WebDataBinderFactory binderFactory) throws Exception { return getTokenInternal( webRequest.getHeader(TOKEN_HEADER), webRequest.getParameter(TOKEN_PARAMETER), parameter.getParameterAnnotation(TokenParam.class).required()); }
@Override public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception { String projectionParameter = webRequest.getParameter(projectionDefinitions.getParameterName()); PersistentEntityProjector projector = new PersistentEntityProjector(projectionDefinitions, projectionFactory, projectionParameter, links.getMappings()); return new PersistentEntityResourceAssembler(entities, projector, links, linkProvider); } }
private OAuth2Parameters getOAuth2Parameters(NativeWebRequest request, String defaultScope, MultiValueMap<String, String> additionalParameters) { OAuth2Parameters parameters = new OAuth2Parameters(additionalParameters); parameters.putAll(getRequestParameters(request, "scope")); parameters.setRedirectUri(callbackUrl(request)); String scope = request.getParameter("scope"); if (scope != null) { parameters.setScope(scope); } else if (defaultScope != null) { parameters.setScope(defaultScope); } return parameters; }