java - Get Etag value from http header from URL -


i can't seem etag value. followed tutorial here:

http://www.mkyong.com/java/how-to-get-http-response-header-in-java/

my code:dr

public void getdatabaseetag(){         try {              url obj = new url("url-here");             urlconnection conn = obj.openconnection();             map<string, list<string>> map = conn.getheaderfields();              system.out.println("printing response header...\n");              (map.entry<string, list<string>> entry : map.entryset()) {                 system.out.println("key : " + entry.getkey()                          + " ,value : " + entry.getvalue());             }              system.out.println("\nget response header key ...\n");             string server = conn.getheaderfield("etag");              if (server == null) {                 system.out.println("key 'etag' not found!");             } else {                 system.out.println("etag - " + server);             }              system.out.println("\n done");          } catch (exception e) {             e.printstacktrace();         }     } 

this code not working. !

edit: additional information: system-out skips on etag , prints other values. when curl -i display etag value! might add url txt file hosted on dropbox, if relevant in anyway. dropbox have deliberately not allowed code access etag value? !

edit:

so here's curl -i -v

* connect() dl.dropboxusercontent.com port 443 (#0) *   trying 23.21.126.112... * 0x8001f130 @ send pipe head! * state: connect => waitconnect handle 0x800574c8; line 1032 (connection #0) * connected dl.dropboxusercontent.com (23.21.126.112) port 443 (#0) * set certificate verify locations: *   cafile: /usr/ssl/certs/ca-bundle.crt   capath: none * sslv3, tls handshake, client hello (1): * state: waitconnect => protoconnect handle 0x800574c8; line 1145 (connection #0) * sslv3, tls handshake, server hello (2): * sslv3, tls handshake, cert (11): * sslv3, tls handshake, server key exchange (12): * sslv3, tls handshake, server finished (14): * sslv3, tls handshake, client key exchange (16): * sslv3, tls change cipher, client hello (1): * sslv3, tls handshake, finished (20): * sslv3, tls change cipher, client hello (1): * sslv3, tls handshake, finished (20): * ssl connection using dhe-rsa-aes256-sha * server certificate: *        subject: c=us; st=california; l=san francisco; o=dropbox, inc; ou=dropbox ops; cn=*.dropboxusercontent.com *        start date: 2013-03-05 00:00:00 gmt *        expire date: 2014-03-12 12:00:00 gmt *        subjectaltname: dl.dropboxusercontent.com matched *        issuer: c=us; o=digicert inc; ou=www.digicert.com; cn=digicert high assurance ca-3 *        ssl certificate verify ok. * state: protoconnect => handle 0x800574c8; line 1164 (connection #0) > head /s/w5hlozna36rlx5l/data.txt http/1.1 > user-agent: curl/7.29.0 > host: dl.dropboxusercontent.com > accept: */* > * state: => do_done handle 0x800574c8; line 1236 (connection #0) * state: do_done => waitperform handle 0x800574c8; line 1352 (connection #0) * state: waitperform => perform handle 0x800574c8; line 1363 (connection #0) * http 1.1 or later persistent connection, pipelining supported < http/1.1 200 ok http/1.1 200 ok < accept-ranges: bytes accept-ranges: bytes < cache-control: max-age=0 cache-control: max-age=0 < content-length: 4206 content-length: 4206 < content-type: text/plain; charset=ascii content-type: text/plain; charset=ascii < date: wed, 04 sep 2013 15:31:42 gmt date: wed, 04 sep 2013 15:31:42 gmt < etag: 3n etag: 3n < pragma: public pragma: public < server: nginx server: nginx < x-dropbox-request-id: a605f78c0ca6b0a97776cdb x-dropbox-request-id: a605f70ec5c0ca6b0a97776cdb < x-requestid: 352c4a9a692dbbae66191266e22d x-requestid: 352c4adbbae66191266e22d < x-server-response-time: 219 x-server-response-time: 219 < connection: keep-alive connection: keep-alive  < * state: perform => done handle 0x800574c8; line 1533 (connection #0) * connection #0 host dl.dropboxusercontent.com left intact 

i not know make of information , how see request missing in java information... required.


Comments

Popular posts from this blog

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

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

mysql - Pass value between different pages (form) with PHP -