java - How to read uploaded file details in Jersey -


i have implemented rest service upload multiple files server.but problem can not file details if use formdatamultipart in rest service.i can file content.like wise tried file details following , gave me error saying not supported.

    @post     @consumes(mediatype.multipart_form_data)     public void upload(formdatamultipart formparams)     {         map<string, list<formdatabodypart>> fieldsbyname = formparams.getfields();         //assume sending files request          (list<formdatabodypart> fields : fieldsbyname.values())         {             (formdatabodypart field : fields)             {                  inputstream = field.getentityas(inputstream.class);                 string filename = field.getname();                 field.getmediatype();                //those work      //this gave me error   formdatacontentdisposition f=field.getentityas(formdatacontentdisposition   .class);     system.out.println(f.getfilename());              }         }     } 

please let me know how can files details type,name,size each uploaded files if use formdatamultipart.

i able access file details here code snippet.

@post     @consumes(mediatype.multipart_form_data)     public void upload(formdatamultipart formparams)     {         map<string, list<formdatabodypart>> fieldsbyname = formparams.getfields();         //assume sending files request          (list<formdatabodypart> fields : fieldsbyname.values())         {             (formdatabodypart field : fields)             {                  inputstream = field.getentityas(inputstream.class);                 string filename = field.getname();                 field.getmediatype();      //this working fine   formdatacontentdisposition f=field.getformdatacontentdisposition();   system.out.println(f.getfilename());              }         }     } 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -