mas kalembo

Greenhorn
+ Follow
since Nov 19, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by mas kalembo

hi
am completely new to the world of java
am working on the project to dispaly apache server status.
I was able to access the file from a remote site as shown below
can anyone help me as to how to pass the information htmlPage(BufferedReader type)from buffer to an applet, so that i can view the information in an applet,rather than Console i/o.
I appreciate inadvance
Here is my code.
import java.net.*;
import java.io.*;
import java.util.*;
class masreader3 {
public static void main(String[] args) throws Exception {
String dataLine;
String masString;
try{
//Get URL object
URL masapache = new URL("http://myserver/server-status/");
//Open a connection to the URL and get a
// URLConnection object.
URLConnection urlConnection = masapache.openConnection();
//Use the connection to get and display the URL
System.out.println(urlConnection.getURL());
//Use the connection to get and display the date last
// modified.
Date lastModified = new Date(
urlConnection.getLastModified());
System.out.println(lastModified);
//Use the connection to get and display the content
// type.
System.out.println(urlConnection.getContentType());
//Use the connection to get an InputStream object.
// Use the InputStream object to instantiate a
// DataInputStream object.
BufferedReader htmlPage =
new BufferedReader(new InputStreamReader(
masapache.openStream()));
//
//Use the DataInputStream object to read and display
// the file one line at a time.
while((dataLine = htmlPage.readLine()) != null){
System.out.println(dataLine);
}//end while loop
}//end try
catch(UnknownHostException e){
System.out.println(e);
System.out.println(
"Must be online to run properly.");
}//end catch
catch(MalformedURLException e){System.out.println(e);}
catch(IOException e){System.out.println(e);}
}//end main
}//end class masreader2

22 years ago