FileUpload MultiPart Filter

<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"> </bean>

 <dependency>
   	<groupId>org.springframework</groupId>
  	 <artifactId>spring-web</artifactId>
  	 <version>${spring.version}</version>
  	 <scope>provided</scope>
</dependency>

================================================================

public class FileUploadMultiPartFilter implements Filter {
    private static final Logger logger = Logger.getLogger(FileUploadMultiPartFilter.class);

    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
            throws IOException, ServletException {
     			 
    	MultipartHttpServletRequest multipartRequest = WebUtils.getNativeRequest(servletRequest, MultipartHttpServletRequest.class);

=================================================================
2023-07-10 17:18:29,288 ERROR [http-nio-8090-exec-6] [[Standalone].[localhost].[/confluence].[default]] log Servlet.service() for servlet [default] in context with path [/confluence] threw exception
java.lang.ClassCastException: class com.atlassian.plugin.servlet.PluginHttpRequestWrapper cannot be cast to class org.springframework.web.multipart.MultipartHttpServletRequest (com.atlassian.plugin.servlet.PluginHttpRequestWrapper is in unnamed module of loader org.apache.catalina.loader.ParallelWebappClassLoader @2f62f7c0; org.springframework.web.multipart.MultipartHttpServletRequest is in unnamed module of loader org.apache.felix.framework.BundleWiringImpl$BundleClassLoader @7acefdfb)
at com.atlassian.tutorial.myPlugin.upload.FileUploadMultiPartFilter.doFilter(FileUploadMultiPartFilter.java:31)
at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:62)

:raising_hand_woman:The parameter is set to ServletRequest in the overridden dofilter, so even if you force a file that comes in as a Multipart type to change to the Multipart HttpServletRequest class, you get an error that the cast does not work.