java - CXF 3.1.6 file upload, attachment datahandler input stream is null -


i'm using cxf , working on file upload i'm receiving file content attachment. upon debug see file payload being present in datahandler object of attachment, when inputstream, content null.

code snippet:

@post @consumes({ mediatype.application_json, mediatype.application_xml,         mediatype.media_type_wildcard }) @produces({ mediatype.application_json, mediatype.application_xml }) @path("/{catalogid}/file") public catalogresponse addfile(@context httpheaders headers,         @pathparam("catalogid") string catalogid, @multipart(value = "requestfile")attachment file,         boolean autolaunch) {     catalogresponse res;     try {         inputstream = file.getdatahandler().getinputstream();         buffer = new bytearrayoutputstream();         int read = 0;         byte[] data = new byte[1024];          [enter image description here][1]while ((read = inputstream.read(data, 0, 1024)) != -1) {                   buffer.write(data, 0, read);                 }         buffer.flush();     }catch (exception ex) {      //handle exception     } 

please find data below. see input stream marked 'closed' causing issue, guess.


Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -