i'm trying implement rest client dropbox jersey 2.0.
following code works fine , file uploaded dropbox.
string targeturl = "https://api-content.dropbox.com/1/files_put?access_token=" + token.access_token + "&root=dropbox&path=public/" + file.getname(); webtarget target = client.target(targeturl); final filedatabodypart filepart = new filedatabodypart("file", file); final multipart multipart = new formdatamultipart().bodypart(filepart); response response = target.request() .put(entity.entity(multipart, multipart.getmediatype()));
however, unnecessary mime boundary included in uploaded file.
original file :
response : { "hash": "3ebf46d672258e1e190b70cc1f0dd5ce", "revision": 87707813, … "size": "0 bytes"}
uploaded file :
--boundary_1_393888375_1373874680685 content-type: text/plain content-disposition: form-data; filename="dropbox.txt"; modification-date="fri, 12 jul 2013 04:23:29 gmt"; size=1328; name="file" response : { "hash": "3ebf46d672258e1e190b70cc1f0dd5ce", "revision": 87707813, … "size": "0 bytes"} --boundary_1_393888375_1373874680685--
is possible remove mime boundary uploaded file?
you uploading using content-type: multipart/form-data
.
you see boundaries because have text/plain
inside multipart/form-data
.
answering question, yes, if change code upload using text/plain
, boundaries go way.
Comments
Post a Comment