This class provides support for uploading files in Blackberry Dynamics Secure Storage together with BBCustomInterceptor.
More...
Inherits RequestBody.
com.good.gd.file.File file = getFileInContatiner();
MultipartBody requestBody = new MultipartBody.Builder().setType(MultipartBody.FORM)
.addFormDataPart("file", file.getName(),
BBFileRequestBody.create(file1, MediaType.get("text/plain")))
.build();
BBCustomInterceptor bbCustomInterceptor = new BBCustomInterceptor();
OkHttpClient httpClient = new OkHttpClient().newBuilder()
.addInterceptor(bbCustomInterceptor)
.authenticator(myAuthenticator)
.build();
bbCustomInterceptor.initAuthenticatorSupport(httpClient);
val request = Request.Builder()
.url(urlStr)
.post(requestBody)
.build()
try (Response response = httpClient.newCall(request).execute()) {
return response.body().string();
}