@ Override protected boolean handleMultiPart ( ) { final boolean ret = super . handleMultiPart ( ) ; try { if ( isMultiPart ( ) && getRequest ( ) instanceof MultipartServletWebRequest ) { for ( final Entry < String , List < FileItem > > entry : ( ( MultipartServletWebRequest ) getRequest ( ) ) . getFiles ( ) . entrySet ( ) ) { int i = - 1 ; if ( entry . getValue ( ) . size ( ) > 1 ) { i = 0 ; } for ( final FileItem fileItem : entry . getValue ( ) ) { final String key = i > - 1 ? entry . getKey ( ) + "_" + i : entry . getKey ( ) ; final FileParameter parameter = new FileParameter ( key , fileItem ) ; Context . getThreadContext ( ) . getFileParameters ( ) . put ( key , parameter ) ; if ( i > - 1 ) { i ++ ; } } } final Map < String , String [ ] > parameters = new HashMap <> ( ) ; final IRequestParameters reqPara = getRequest ( ) . getRequestParameters ( ) ; for ( final String name : reqPara . getParameterNames ( ) ) { final List < StringValue > values = reqPara . getParameterValues ( name ) ; final String [ ] valArray = new String [ values . size ( ) ] ; int i = 0 ; for ( final StringValue value : values ) { valArray [ i ] = value . toString ( ) ; i ++ ; } parameters . put ( name , valArray ) ; } Context . getThreadContext ( ) . getParameters ( ) . putAll ( parameters ) ; } } catch ( final EFapsException e ) { throw new RestartResponseAtInterceptPageException ( new ErrorPage ( e ) ) ; } return ret ; }
Handle the multipart to store the files and parameters in the context also .