Java Code Examples for org.springframework.web.multipart.support.MultipartResolutionDelegate#isMultipartArgument()
The following examples show how to use
org.springframework.web.multipart.support.MultipartResolutionDelegate#isMultipartArgument() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WxArgumentResolver.java From FastBootWeixin with Apache License 2.0 | 8 votes |
@Override protected void handleMissingValue(String name, MethodParameter parameter, NativeWebRequest request) throws Exception { HttpServletRequest servletRequest = request.getNativeRequest(HttpServletRequest.class); if (MultipartResolutionDelegate.isMultipartArgument(parameter)) { if (!MultipartResolutionDelegate.isMultipartRequest(servletRequest)) { throw new MultipartException("Current request is not a multipart request"); } else { throw new MissingServletRequestPartException(name); } } else { throw new MissingServletRequestParameterException(name, parameter.getNestedParameterType().getSimpleName()); } }
Example 2
Source File: RequestParamMethodArgumentResolver.java From spring-analysis-note with MIT License | 6 votes |
@Override protected void handleMissingValue(String name, MethodParameter parameter, NativeWebRequest request) throws Exception { HttpServletRequest servletRequest = request.getNativeRequest(HttpServletRequest.class); if (MultipartResolutionDelegate.isMultipartArgument(parameter)) { if (servletRequest == null || !MultipartResolutionDelegate.isMultipartRequest(servletRequest)) { throw new MultipartException("Current request is not a multipart request"); } else { throw new MissingServletRequestPartException(name); } } else { throw new MissingServletRequestParameterException(name, parameter.getNestedParameterType().getSimpleName()); } }
Example 3
Source File: RequestParamMethodArgumentResolver.java From java-technology-stack with MIT License | 6 votes |
@Override protected void handleMissingValue(String name, MethodParameter parameter, NativeWebRequest request) throws Exception { HttpServletRequest servletRequest = request.getNativeRequest(HttpServletRequest.class); if (MultipartResolutionDelegate.isMultipartArgument(parameter)) { if (servletRequest == null || !MultipartResolutionDelegate.isMultipartRequest(servletRequest)) { throw new MultipartException("Current request is not a multipart request"); } else { throw new MissingServletRequestPartException(name); } } else { throw new MissingServletRequestParameterException(name, parameter.getNestedParameterType().getSimpleName()); } }
Example 4
Source File: RequestParamMethodArgumentResolver.java From lams with GNU General Public License v2.0 | 6 votes |
@Override protected void handleMissingValue(String name, MethodParameter parameter, NativeWebRequest request) throws Exception { HttpServletRequest servletRequest = request.getNativeRequest(HttpServletRequest.class); if (MultipartResolutionDelegate.isMultipartArgument(parameter)) { if (!MultipartResolutionDelegate.isMultipartRequest(servletRequest)) { throw new MultipartException("Current request is not a multipart request"); } else { throw new MissingServletRequestPartException(name); } } else { throw new MissingServletRequestParameterException(name, parameter.getNestedParameterType().getSimpleName()); } }
Example 5
Source File: RequestPartMethodArgumentResolver.java From spring-analysis-note with MIT License | 5 votes |
/** * Whether the given {@linkplain MethodParameter method parameter} is a multi-part * supported. Supports the following: * <ul> * <li>annotated with {@code @RequestPart} * <li>of type {@link MultipartFile} unless annotated with {@code @RequestParam} * <li>of type {@code javax.servlet.http.Part} unless annotated with * {@code @RequestParam} * </ul> */ @Override public boolean supportsParameter(MethodParameter parameter) { if (parameter.hasParameterAnnotation(RequestPart.class)) { return true; } else { if (parameter.hasParameterAnnotation(RequestParam.class)) { return false; } return MultipartResolutionDelegate.isMultipartArgument(parameter.nestedIfOptional()); } }
Example 6
Source File: RequestParamMethodArgumentResolver.java From spring-analysis-note with MIT License | 5 votes |
/** * Supports the following: * <ul> * <li>@RequestParam-annotated method arguments. * This excludes {@link Map} params where the annotation does not specify a name. * See {@link RequestParamMapMethodArgumentResolver} instead for such params. * <li>Arguments of type {@link MultipartFile} unless annotated with @{@link RequestPart}. * <li>Arguments of type {@code Part} unless annotated with @{@link RequestPart}. * <li>In default resolution mode, simple type arguments even if not with @{@link RequestParam}. * </ul> */ @Override public boolean supportsParameter(MethodParameter parameter) { if (parameter.hasParameterAnnotation(RequestParam.class)) { if (Map.class.isAssignableFrom(parameter.nestedIfOptional().getNestedParameterType())) { RequestParam requestParam = parameter.getParameterAnnotation(RequestParam.class); return (requestParam != null && StringUtils.hasText(requestParam.name())); } else { return true; } } else { if (parameter.hasParameterAnnotation(RequestPart.class)) { return false; } parameter = parameter.nestedIfOptional(); if (MultipartResolutionDelegate.isMultipartArgument(parameter)) { return true; } else if (this.useDefaultResolution) { return BeanUtils.isSimpleProperty(parameter.getNestedParameterType()); } else { return false; } } }
Example 7
Source File: RequestPartMethodArgumentResolver.java From java-technology-stack with MIT License | 5 votes |
/** * Whether the given {@linkplain MethodParameter method parameter} is a multi-part * supported. Supports the following: * <ul> * <li>annotated with {@code @RequestPart} * <li>of type {@link MultipartFile} unless annotated with {@code @RequestParam} * <li>of type {@code javax.servlet.http.Part} unless annotated with * {@code @RequestParam} * </ul> */ @Override public boolean supportsParameter(MethodParameter parameter) { if (parameter.hasParameterAnnotation(RequestPart.class)) { return true; } else { if (parameter.hasParameterAnnotation(RequestParam.class)) { return false; } return MultipartResolutionDelegate.isMultipartArgument(parameter.nestedIfOptional()); } }
Example 8
Source File: RequestParamMethodArgumentResolver.java From java-technology-stack with MIT License | 5 votes |
/** * Supports the following: * <ul> * <li>@RequestParam-annotated method arguments. * This excludes {@link Map} params where the annotation does not specify a name. * See {@link RequestParamMapMethodArgumentResolver} instead for such params. * <li>Arguments of type {@link MultipartFile} unless annotated with @{@link RequestPart}. * <li>Arguments of type {@code Part} unless annotated with @{@link RequestPart}. * <li>In default resolution mode, simple type arguments even if not with @{@link RequestParam}. * </ul> */ @Override public boolean supportsParameter(MethodParameter parameter) { if (parameter.hasParameterAnnotation(RequestParam.class)) { if (Map.class.isAssignableFrom(parameter.nestedIfOptional().getNestedParameterType())) { RequestParam requestParam = parameter.getParameterAnnotation(RequestParam.class); return (requestParam != null && StringUtils.hasText(requestParam.name())); } else { return true; } } else { if (parameter.hasParameterAnnotation(RequestPart.class)) { return false; } parameter = parameter.nestedIfOptional(); if (MultipartResolutionDelegate.isMultipartArgument(parameter)) { return true; } else if (this.useDefaultResolution) { return BeanUtils.isSimpleProperty(parameter.getNestedParameterType()); } else { return false; } } }
Example 9
Source File: RequestPartMethodArgumentResolver.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Supports the following: * <ul> * <li>annotated with {@code @RequestPart} * <li>of type {@link MultipartFile} unless annotated with {@code @RequestParam} * <li>of type {@code javax.servlet.http.Part} unless annotated with {@code @RequestParam} * </ul> */ @Override public boolean supportsParameter(MethodParameter parameter) { if (parameter.hasParameterAnnotation(RequestPart.class)) { return true; } else { if (parameter.hasParameterAnnotation(RequestParam.class)) { return false; } return MultipartResolutionDelegate.isMultipartArgument(parameter.nestedIfOptional()); } }
Example 10
Source File: RequestParamMethodArgumentResolver.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Supports the following: * <ul> * <li>@RequestParam-annotated method arguments. * This excludes {@link Map} params where the annotation doesn't * specify a name. See {@link RequestParamMapMethodArgumentResolver} * instead for such params. * <li>Arguments of type {@link MultipartFile} * unless annotated with @{@link RequestPart}. * <li>Arguments of type {@code javax.servlet.http.Part} * unless annotated with @{@link RequestPart}. * <li>In default resolution mode, simple type arguments * even if not with @{@link RequestParam}. * </ul> */ @Override public boolean supportsParameter(MethodParameter parameter) { if (parameter.hasParameterAnnotation(RequestParam.class)) { if (Map.class.isAssignableFrom(parameter.nestedIfOptional().getNestedParameterType())) { String paramName = parameter.getParameterAnnotation(RequestParam.class).name(); return StringUtils.hasText(paramName); } else { return true; } } else { if (parameter.hasParameterAnnotation(RequestPart.class)) { return false; } parameter = parameter.nestedIfOptional(); if (MultipartResolutionDelegate.isMultipartArgument(parameter)) { return true; } else if (this.useDefaultResolution) { return BeanUtils.isSimpleProperty(parameter.getNestedParameterType()); } else { return false; } } }