protected URI doPostCreateMultipart ( String path , FormDataMultiPart formDataMultiPart ) throws ClientException { this . readLock . lock ( ) ; try { ClientResponse response = getResourceWrapper ( ) . rewritten ( path , HttpMethod . POST ) . type ( Boundary . addBoundary ( MediaType . MULTIPART_FORM_DATA_TYPE ) ) . accept ( MediaType . TEXT_PLAIN ) . post ( ClientResponse . class , formDataMultiPart ) ; errorIfStatusNotEqualTo ( response , ClientResponse . Status . OK , ClientResponse . Status . CREATED ) ; try { return response . getLocation ( ) ; } finally { response . close ( ) ; } } catch ( ClientHandlerException ex ) { throw new ClientException ( ClientResponse . Status . INTERNAL_SERVER_ERROR , ex . getMessage ( ) ) ; } finally { this . readLock . unlock ( ) ; } }
Creates a resource specified as a multi - part form . Adds appropriate Accepts and Content Type headers .