I am trying to check if the file was modified after the specified date. I found this. I am trying to use HttpURLConnection Java to execute a "conditional get", but I never get the status code 304 . which seemed necessary to me. But if I try:
URLConnection connection = new URL("http://cdn3.sstatic.net/stackoverflow/img/favicon.ico").openConnection(); connection.setRequestProperty("If-Modified-Since", "Wed, 06 Oct 2010 02:53:46 GMT"); System.out.println(connection.getHeaderFields());
Output:
{null=[HTTP/1.1 200 OK], ETag=["087588e2bb5cd1:0"], Date=[Wed, 28 Nov 2012 12:39:31 GMT], Content-Length=[1150], Last-Modified=[Sun, 28 Oct 2012 16:44:54 GMT], Accept-Ranges=[bytes], Connection=[keep-alive], Content-Type=[image/x-icon], X-Cache=[HIT], Server=[NetDNA-cache/2.2], Cache-Control=[max-age=604800]}
Edit
I tried today, but still don't return 304.
Wednesday, 28 Nov 2012 12:59:56 GMT
It should return 304, but as you can see, no, any help is assigned.
source share