Re: How to get lastmodified date of file (which is in internet)

From: szymex (szymex_at_vp.pl)
Date: 04/25/04


Date: Sun, 25 Apr 2004 18:36:22 +0200


> szymex wrote:
> > I used getlastmodified from URLConnection but it gave me date of last
> > modified of index.htm file. For example: I'm checking address
> > http://localhost/test.txt and I got date of last modified of file from
> > http://localhost/index.htm. What shall I do??
>
> What code are you using? And is your server set up to send the
> Last-Modified header?
>
> --
>
> Martin Honnen
> http://JavaScript.FAQTs.com/
>

            String adr = "http://localhost/test.txt";
            URL url = new URL(adr);
            java.net.URLConnection cnn = url.openConnection() ;
            cnn.connect();
            long dt = cnn.getLastModified();