dcsimg
Accessing HTTP MIME Header using HttpURLConnection
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Mazhar_Patel
Posted On:   Thursday, May 16, 2002 11:34 AM

I have built an application which downloads given URL page and search the page for some new contents. To minimize the process and data transfer rate ,i used MIME header of given URL ,in which I checked for Last-Modified Date and Content Length fields and if there is any changes then only application downloads it. I have used HttpURLConnection ,in which I used setRequestMethod("HEAD") to get MIME Header of URL ,but the problems is not each URL return Content-Length or Last-ModifiedDate in their MIME Header ,so Is their any method through which I could get solve thid problem . I want each MIME header should have Content-Length and Last-ModifiedDate field ,so that I could optimize my application process.    More>>

I have built an application which downloads given URL page and search the page for some new contents.



To minimize the process and data transfer rate ,i used MIME header of given URL ,in which I checked for Last-Modified Date and Content Length fields and if there is any changes then only application downloads it.



I have used HttpURLConnection ,in which I used setRequestMethod("HEAD") to get MIME Header of URL ,but the problems is not each URL return Content-Length or Last-ModifiedDate in their MIME Header ,so Is their any method through which I could get solve thid problem .
I want each MIME header should have Content-Length and Last-ModifiedDate field ,so that I could optimize my application process.



thanks
Mazhar Patel

   <<Less

Re: Accessing HTTP MIME Header using HttpURLConnection

Posted By:   Lunkwill_Vroomfondel  
Posted On:   Thursday, May 16, 2002 03:56 PM

if your connection-peer does not submit content-length then he does not submit it.

this could be because "he" doesnt know it in the moment the header was created (eg. dynamic content) or he simply doesnt want it.



you could either try to control each of your connection-peers or you could write a wrapper for these incomplete connections.

in this wrapper you read in the whole stream, calculate its length and produce an outputstream whose content-length header is correctly set. but i doubt this is what you can combine with your optimization process ;-)
About | Sitemap | Contact