tr****@gmail.co m napisal(a):
I want to make these requests from the client browser, and it will not
work as a proxy request from my web server. Any ideas on how to make
this work? Please provide a working example if available...
First i agree with my followers... another way to get status code is to
write java applet and put it as object with width and height equal to 0
px and visibility to hidden (css). Inside java aplet you can write
method to make call to any server you want, and call that method from
JavaScript using LiveConnect. Example:
ScriptableClock .java
-----------------------------
public void setTimeZone(Str ing zone) {
stop();
timeZone = (zone.startsWit h("GMT")) ? true : false;
start();
}
public void setFont(String newFont, String newStyle, String newSize) {
stop();
if (newFont != null && newFont != "")
fontName = newFont;
if (newStyle != null && newStyle != "")
setFontStyle(ne wStyle);
if (newSize != null && newSize != "")
setFontSize(new Size);
displayFont = new Font(fontName, fontStyle, fontSize);
start();
}
public void setColor(String newbgColor, String newfgColor) {
stop();
bgColor = parseColor(newb gColor);
fgColor = parseColor(newf gColor);
start();
}
public String getInfo() {
String result = "Info about ScriptableClock .class\r\n";
result += "Version/Date: 1.0d1/2 May 1996\r\n";
result += "Author: Danny Goodman (da****@dannyg. com)\r\n";
result += "Public Variables:\r\n" ;
result += " (None)\r\n\r\n" ;
result += "Public Methods:\r\n";
result += " setTimeZone(\"G MT\" | \"Locale\")\r\n ";
result += " setFont(\"fontN ame\",\"Plain\" |\"Bold\" |
\"Italic\",
\"fontSize\")\r \n";
result += " setColor(\"bgCo lorName\",
\"fgColorName\" )\r\n";
result += " colors: Black, White, Red, Green, Blue, Yellow\r\n";
return result;
}
ScriptableClock .html
------------------------------
<html>
<head>
<title>Clock with Lots o' Widgets</title>
<script type="text/javascript">
function setTimeZone(pop up) {
var choice = popup.options[popup.selectedI ndex].value;
document.clock2 .setTimeZone(ch oice);
}
function setColor(form) {
var bg = form.background Color.options[
form.background Color.selectedI ndex].value;
var fg = form.foreground Color.options[
form.foreground Color.selectedI ndex].value;
document.clock2 .setColor(bg, fg);
}
function setFont(form) {
var fontName = form.theFont.op tions[form.theFont.se lectedIndex].value;
var fontStyle = form.theStyle.o ptions[
form.theStyle.s electedIndex].value;
var fontSize = form.theSize.op tions[form.theSize.se lectedIndex].value;
document.clock2 .setFont(fontNa me, fontStyle, fontSize);
}
function getAppletInfo(f orm) {
form.details.va lue = document.clock2 .getInfo();
}
function showSource() {
var newWindow = window.open("Sc riptableClock.j ava","",
"width=450,heig ht=300,resizabl e,scrollbars");
}
</script>
</head>
<body>
<applet code="Scriptabl eClock.class" name="clock2"
width="500"
height="45">
<param name="bgColor" value="Black" />
<param name="fgColor" value="Red" />
</applet>
<form name="widgets2" >
Select Time Zone: <select name="zone"
onchange="setTi meZone(this)">
<option selected="selec ted" value="Locale"> Local Time</option>
<option value="GMT">Gre enwich Mean Time</option>
</select>
<p>Select Background Color: <select name="backgroun dColor"
onchange="setCo lor(this.form)" >
<option value="White">W hite</option>
<option selected="selec ted" value="Black">B lack</option>
<option value="Red">Red </option>
<option value="Green">G reen</option>
<option value="Blue">Bl ue</option>
<option value="Yellow"> Yellow</option>
</select> Select Color Text Color: <select name="foregroun dColor"
onchange="setCo lor(this.form)" >
<option value="White">W hite</option>
<option value="Black">B lack</option>
<option selected="selec ted" value="Red">Red </option>
<option value="Green">G reen</option>
<option value="Blue">Bl ue</option>
<option value="Yellow"> Yellow</option>
</select></p>
<p>Select Font: <select name="theFont"
onchange="setFo nt(this.form)">
<option selected="selec ted" value="TimesRom an">Times
Roman</option>
<option value="Helvetic a">Helvetica </option>
<option value="Courier" >Courier</option>
<option value="Arial">A rial</option>
</select><br />
Select Font Style: <select name="theStyle"
onchange="setFo nt(this.form)">
<option selected="selec ted" value="Plain">P lain</option>
<option value="Bold">Bo ld</option>
<option value="Italic"> Italic</option>
</select><br />
Select Font Size: <select name="theSize"
onchange="setFo nt(this.form)">
<option value="12">12</option>
<option value="18">18</option>
<option selected="selec ted" value="24">24</option>
<option value="30">30</option>
</select></p>
<hr />
<input type="button" name="getInfo" value="Applet Info"
onclick="getApp letInfo(this.fo rm)" />
<p><textarea name="details" rows="11" cols="70">
</textarea></p>
</form>
<hr />
</body>
</html>
Here above it is only example, the classes you really need to use is
Socket Java class and emulate HTTP GET or POST or use simple Jakarta
HttpClient (see google).
Hope it helps.
BR
Luke M.