[3568] in java-interest

home help back first fref pref prev next nref lref last post

Fetching URL's content in Applet with Netscape/2b

daemon@ATHENA.MIT.EDU (KiHong Kim)
Thu Nov 16 07:37:06 1995

Date: Thu, 16 Nov 1995 19:50:55 +0900
From: KiHong Kim <next@cimcenter.snu.ac.kr>
To: java-interest@java.sun.com

Is it possible to get the content of a URL in an Applet ?

The following code works well with "appletviewer".
But it fails with Netscape/2b.
"displayMessage(...)" shows "28" with appletviewer.
However, it shows "0" with Netscape/2b.
What should I do ?

 ...
 try {

   URL myURL = new URL( "http://cimcenter/~next/mytest.cgi" );
   URLConnection myUC = myURL.openConnection();

   myUC.connect();

   // unexpected behavior in the next statement
   displayMessage( Integer.toString( myUC.getContentLength() ) );

 } catch ( MalformedURLException e ) {
   e.printStackTrace();
 } catch ( IOException e ) {
   e.printStackTrace();
 }
 ...

Thank you for reading.

  - Ki Hong(E-mail: next@cimcenter.snu.ac.kr)
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post