You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Chris Ward <cw...@horizon-asset.co.uk> on 2004/09/06 12:24:38 UTC

Getting lastModified() from a (relative) URL

Hi,

I'm just switching my servlets to read files using URLs rather
than fully qualified filenames - which is fine - but I can't figure
out how to get the files "last modified" value.  I can get a
lastModified
header value from the connection but I'm not reading HTML files (if this
makes any sense).

This is what I've been using to read from the relative URLs.

			URL myURL = new URL(
				req.getScheme(),
				req.getServerName(),
				req.getServerPort(),
				req.getParameter("URL")
				);
            	HttpURLConnection conn =
(HttpURLConnection)myURL.openConnection();
			...
			...

I need this info' because some of my apps' are caching files and need to
notice when they've change on disc.

Couldn't find anything in the archive.

Thanks,
Chris

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org