Article View: borland.public.jbuilder.java.language
Article #19624URL or URLConnection broken??
From: Robert Lebowitz
Date: Thu, 15 Jan 1998 00:00
Date: Thu, 15 Jan 1998 00:00
21 lines
1249 bytes
1249 bytes
I wrote the following little snippet of code. I was specifically
interested in gathering various pieces of information about the remote
file such as date last modified, and content type. However, I always
get the same responses: 0 for date last modified, and text/html for
content type.
Is there a secret to making this work? I used to do this all the time
when I used Kawa with the JDK 1.1.x distribution.
import java.net.*;
public class testit {
static public void main(String[] args) throws Exception {
URL hp = new URL("http://myserver.com/Images/new.gif");
URLConnection hpc = hp.openConnection();
System.out.println(hpc.getContentType());
System.out.println(hpc.getLastModified());
}
}
Technical Details
Message-ID:
<34BE5606.2FF6@finaltouch.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,dbb1eb762ffa6fc2,start X-Google-Attributes: gidf74b3,public From: Robert Lebowitz <lebowitz@finaltouch.com> Subject: URL or URLConnection broken?? Date: 1998/01/15 Message-ID: <34BE5606.2FF6@finaltouch.com> X-Deja-AN: 316268160 Content-Transfer-Encoding: 7bit Mime-Version: 1.0 Reply-To: lebowitz@finaltouch.com Content-Type: text/plain; charset=us-ascii Organization: Finaltouch.com Newsgroups: borland.public.jbuilder.java.language