Basic HTML version of Foils prepared 18 May 97

Foil 33 Accessing URL's in Java -- URLConnection

From Java Tutorial - Spring 1997 Part 4: Multithreading, useful Java classes, I/O, Networking, and the future Peking Tutorial, Web Certificate -- Spring-Summer 1997. by Nancy J. McCracken,Geoffrey C. Fox


1 More interesting is to access a URL and process the information there!
2 This is done using streams:
3 There are methods in class URL --
4 InputStream in = instanceofURL.openStream(); // opens an InputStream associated with given url
5 More general is instanceofURL.openConnection() establishes a general connection and returns an instance of class URLConnection
  • This provides most general HTTP connectivity and indeed has some advantages over sockets as these are subject to special security restrictions in Netscape's current implementation
6 Note that one can connect not just to HTML files but also to CGI scripts i.e. programs at server and so obtain flexible connectivity

in Table To:


© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Thu Jan 8 1998