rest - can we add "MultiPartWriter" to "HttpClientConfig" -
during rest call, passing file path , rest api @ server end write content data set. while passing file getting below error: "com.sun.jersey.api.client.clienthandlerexception: com.sun.jersey.api.client.clienthandlerexception: message body writer java type, class com.sun.jersey.multipart.formdatamultipart, type, multipart/form-data, not found"
i using httpclientconfig client.
webresource getclient(){ if (client == null) { client = httpclientconfig.getclient(baseurl.getscheme(), this.skipcertvalidation); client.addfilter(new httpbasicauthfilter(username, system.getenv(constants.env_password))); client.addfilter(new genericresponsefilter()); } return client.resource(baseurl); } this code using pass file path:
filedatabodypart fp = new filedatabodypart("file", datafilepath, mediatype.application_octet_stream_type); formdatamultipart part = new formdatamultipart(); part.bodypart(fp); clientresponse response = webresource.header("data-type", datatype).type(part.getmediatype()).put(clientresponse.class, part); can please share how can register httpclientconfig multipartwriter.
Comments
Post a Comment