public void processRequest ( HttpServletRequest request ) throws IOException , FileUploadException , StorageClientException , AccessDeniedException { boolean debug = LOGGER . isDebugEnabled ( ) ; if ( ServletFileUpload . isMultipartContent ( request ) ) { if ( debug ) { LOGGER . debug ( "Multipart POST " ) ; } feedback . add ( "Multipart Upload" ) ; ServletFileUpload upload = new ServletFileUpload ( ) ; FileItemIterator iterator = upload . getItemIterator ( request ) ; while ( iterator . hasNext ( ) ) { FileItemStream item = iterator . next ( ) ; if ( debug ) { LOGGER . debug ( "Got Item {}" , item ) ; } String name = item . getFieldName ( ) ; InputStream stream = item . openStream ( ) ; if ( item . isFormField ( ) ) { ParameterType pt = ParameterType . typeOfRequestParameter ( name ) ; String propertyName = RequestUtils . propertyName ( pt . getPropertyName ( name ) ) ; RequestUtils . accumulate ( stores . get ( pt ) , propertyName , RequestUtils . toValue ( name , Streams . asString ( stream ) ) ) ; feedback . add ( pt . feedback ( propertyName ) ) ; } else { if ( streamProcessor != null ) { feedback . addAll ( streamProcessor . processStream ( name , StorageClientUtils . getObjectName ( item . getName ( ) ) , item . getContentType ( ) , stream , this ) ) ; } } } if ( debug ) { LOGGER . debug ( "No More items " ) ; } } else { if ( debug ) { LOGGER . debug ( "Trad Post " ) ; } // use traditional unstreamed operations. @ SuppressWarnings ( "unchecked" ) Map < String , String [ ] > parameters = request . getParameterMap ( ) ; if ( debug ) { LOGGER . debug ( "Traditional POST {} " , parameters ) ; } Set < Entry < String , String [ ] > > entries = parameters . entrySet ( ) ; for ( Entry < String , String [ ] > param : entries ) { String name = ( String ) param . getKey ( ) ; ParameterType pt = ParameterType . typeOfRequestParameter ( name ) ; String propertyName = RequestUtils . propertyName ( pt . getPropertyName ( name ) ) ; RequestUtils . accumulate ( stores . get ( pt ) , propertyName , RequestUtils . toValue ( name , param . getValue ( ) ) ) ; feedback . add ( pt . feedback ( propertyName ) ) ; } } }
Process the request in a stream .