java - Get Metadata from Dropbox Link Without Auth -


i want check version changed/get metadata of text-file shared link on dropbox. not using dropbox api makes users use own accounts. want them link account , cannot manually since might change password later.

so: no auth token, metadata shared link of dropbox can check version changes , if version has changed download contents of new file.

also: i'm open other suggestions make work well. please explain in little detail solution.

updated e-tag issue:

public void getfromonlinetxtdatabase(){         try{             url url = new url("url-here");             httpurlconnection.setfollowredirects(true);             httpurlconnection con = (httpurlconnection) url.openconnection();             con.setdooutput(false);             con.setreadtimeout(20000);             con.setrequestproperty("connection", "keep-alive");             //get etag update check                 string etag = con.getheaderfield("etag");             //string etag= "";              con.setrequestproperty("user-agent", "mozilla/5.0 (windows nt 6.1; wow64; rv:16.0) gecko/20100101 firefox/16.0");             ((httpurlconnection) con).setrequestmethod("get");             //system.out.println(con.getcontentlength()) ;             con.setconnecttimeout(5000);             bufferedinputstream in = new bufferedinputstream(con.getinputstream());             int responsecode = con.getresponsecode();             if (responsecode == httpurlconnection.http_ok) {                 system.out.println(responsecode);             }             stringbuffer buffer = new stringbuffer();             int chars_read;             //int total = 0;             while ((chars_read = in.read()) != -1)              {                 char g = (char) chars_read;                 buffer.append(g);             }             final string page = buffer.tostring();             //create password_ems.txt internal             if (fileexistance("data.txt")){                 file dir = getfilesdir();                 file file = new file(dir, "data.txt");                 boolean deleted = file.delete();                 stringtotxt(page, "data.txt");               }else{                 stringtotxt(page, "data.txt");             }              if (fileexistance("data_etag.txt")){                 file dir = getfilesdir();                 file file = new file(dir, "etag.txt");                 boolean deleted = file.delete();                 stringtotxt(etag, "etag.txt");               }else{                 //create etag_file                 stringtotxt(etag, "data_etag.txt");             }              //  log.i("page", page);         }catch(exception e){             showdialog("database fetch failure","unable fetch password database, check internet" +                     " connection , try again later.",0);             log.i("page", "error");         }      } 

if http head request against public or shared dropbox url, you'll get, among other things, etag header. don't know behavior guaranteed, since don't think it's documented anywhere, @ least etag header can used determine when file has changed. (if etag different, file has changed.)

edit

in general when using etags, efficient thing issue get request header of if-none-match: <old etag>. if content hasn't changed, respond 304, if content has changed, download new content per normal get request (and response 200).


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -