public RequestBuilder createFileUploadRequestBuilder ( String httpUrl , String methodName , String reqBodyAsString ) throws IOException { Map < String , Object > fileFieldNameValueMap = getFileFieldNameValue ( reqBodyAsString ) ; List < String > fileFieldsList = ( List < String > ) fileFieldNameValueMap . get ( FILES_FIELD ) ; MultipartEntityBuilder multipartEntityBuilder = MultipartEntityBuilder . create ( ) ; /* * Allow fileFieldsList to be null. * fileFieldsList can be null if multipart/form-data is sent without any files * Refer Issue #168 - Raised and fixed by santhoshTpixler */ if ( fileFieldsList != null ) { buildAllFilesToUpload ( fileFieldsList , multipartEntityBuilder ) ; } buildOtherRequestParams ( fileFieldNameValueMap , multipartEntityBuilder ) ; buildMultiPartBoundary ( fileFieldNameValueMap , multipartEntityBuilder ) ; return createUploadRequestBuilder ( httpUrl , methodName , multipartEntityBuilder ) ; }
This is the http request builder for file uploads using Apache Http Client . In case you want to build or prepare the requests differently you can override this method .