private static UploadStream getUploadStream ( HttpServletRequest httpRequest , Type [ ] formalParameters ) throws IOException { FormIterator form = new FormIteratorImpl ( httpRequest ) ; if ( ! form . hasNext ( ) ) { throw new IllegalArgumentException ( "Empty form." ) ; } Part part = form . next ( ) ; if ( ! ( part instanceof UploadStream ) ) { throw new IllegalArgumentException ( "Illegal form. Expected uploaded stream but got field |%s|." , part . getName ( ) ) ; } return ( UploadStream ) part ; }
Get upload stream from given HTTP request . This method expects on HTTP request a multipart form with a single part of byte stream type . Returns an upload stream instance wrapping the form stream part .