[2887] in java-interest
server side dir listing
daemon@ATHENA.MIT.EDU (stevem@tcdl.co.uk)
Thu Oct 19 14:41:09 1995
From: stevem@tcdl.co.uk
Date: Thu, 19 Oct 1995 16:18:19 +0100
To: java-interest@java.sun.com
Does anyone know how I can get a listing of the contents of a directory on the server side.
I want my applet to display a list of images which are available for download, and show
thumbnails of the images. The problem is that the number of images and the filenames
of the images will change with time.
I tried this function as a test
static private void getnames()
{
URL myurl = new URL ( "http://www/java/" ) ;
URLConnection myconn = myurl.openConnection() ;
System.out.println (myconn.getContentType() );
Object myobject = myconn.getContent() ;
System.out.println ( myobject ) ;
}
but I received the following error message
java.lang.ClassNotFoundException sun/net/www/content/text/html
at java.net.URLConnection.getContentHandler(URLConnection.java)
at java.net.URLConnection.getContent(URLConnection.java)
at mypaint.getnames(mypaint.java:60)
at mypaint.main(mypaint.java:28)
java/io/InputStream.java/io/FilterInputStream.sun/net/www/MeteredStream[expected=525, count=0, url=java/net/URL, closed=?00000000, in=java/io/InputStream.java/io/FilterInputStream.java/io/BufferedInputStream]
It seems the html content class does not exist. Has anyone written these classes, or are they
easy to write.
Any help would be gratefully received.
----------------------------------------------------------------------
Steve Millidge Senior Software Engineer
The Computer Department Ltd. Tel: +44 (0)1684 584100
Cirrus House Fax: +44 (0)1684 892812
9 Spring Lane North, Malvern Email: stevem@tcdl.co.uk
Worcs. WR14 1BU
United Kingdom
----------------------------------------------------------------------
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com