Class MultipartItemResolver
- All Implemented Interfaces:
ParameterResolver
MultipartItem, MultipartItem[], or List<MultipartItem>.
This class is responsible for resolving multipart file uploads in the context of an MVC request.
It supports single file resolution, arrays of files, and lists of files, using the MultipartHttpServletRequest.
The resolver checks for the presence of the RequestParam annotation to determine the parameter name
and whether the parameter is required. If the required parameter is missing, a ResolverResult.failed(T, java.util.List<fr.paris.lutece.portal.util.mvc.binding.BindingError>)
is returned with an appropriate error message.
This class is annotated with ApplicationScoped, meaning it is managed by the CDI container and shared
across the application.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionResolves the value of the given parameter from theHttpServletRequest.booleanDetermines whether this resolver supports the given parameter.
-
Constructor Details
-
MultipartItemResolver
public MultipartItemResolver()
-
-
Method Details
-
supports
Determines whether this resolver supports the given parameter.This method checks if the parameter type is
MultipartItem,MultipartItem[], orList<MultipartItem>.- Parameters:
parameter- The method parameter to check.- Returns:
trueif the parameter type is supported,falseotherwise.
-
resolve
public ResolverResult<?> resolve(jakarta.servlet.http.HttpServletRequest request, Parameter parameter) Resolves the value of the given parameter from theHttpServletRequest.This method retrieves the parameter name from the
RequestParamannotation if present, and resolves the value based on the parameter type. Supported types include:MultipartItem- Single file upload.MultipartItem[]- Array of file uploads.List<MultipartItem>- List of file uploads.
- Parameters:
request- The HTTP request containing the multipart data.parameter- The method parameter to resolve.- Returns:
- A
ResolverResultcontaining the resolved value or an error if resolution fails.
-