Client Side JavaScript HTTP request:
"Java gives me a nice quiet back channel."
Richard M. Smith wrote HTTPGet.
A mysterious source has a Java applet.
Danny Goodman writes from 1998/11/11 :
"In "JavaScript Bible" you'll find source code for a small (faceless) Java applet that reads a server text file as the page loads. Once the page has loaded, a script can grab the text from the applet and then generate either a new page (for display in a new window or another frame) with data retrieved from the applet.
"Dynamic HTML: The Definitive Reference"
"JavaScript Bible", 3rd Edition
2) You need to use java via an applet or via liveconnect to test; the
following reads the http status line that the server is sending after an
http request:function fetchHTTPStatus (url) {
if ((location.host == '') || (url.indexOf(location.host) == -1))
netscape.security.PrivilegeManager.enablePrivilege('UniversalConnect');
var urlObj = new java.net.URL (url); var host = urlObj.getHost();
var port = (urlObj.getPort() > 0) ? urlObj.getPort() : 80;
var fileName = urlObj.getFile(); var sock = new java.net.Socket (host, port);
dock = new java.io.DataOutputStream(sock.getOutputStream());
dock.writeBytes('GET ' + fileName + ' HTTP/1.0\r\n'); // could use HEAD
dock.writeBytes('\r\n');
var dis = new java.io.DataInputStream(sock.getInputStream());
line = dis.readLine(); // get just status message dis.close(); dock.close();
sock.close(); return line;}
var status = fetchHTTPStatus('http://www.yahoo.com/whatever');
if (status.indexOf('200') != -1) //
Note that the server has to exist and to be running. For further checks
(depending of what you regard as valid) a java applet is better suited to
handle the various exceptions that can occur. As for the all the
java/liveconnect connect stuff:
script file: url to file: url and http: url and script
http://www.someserver.tld/ url to same server works without signing, all
else require signing the script/applet..