(e-mail address removed) 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(String zone) {
stop();
timeZone = (zone.startsWith("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(newStyle);
if (newSize != null && newSize != "")
setFontSize(newSize);
displayFont = new Font(fontName, fontStyle, fontSize);
start();
}
public void setColor(String newbgColor, String newfgColor) {
stop();
bgColor = parseColor(newbgColor);
fgColor = parseColor(newfgColor);
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 (
[email protected])\r\n";
result += "Public Variables:\r\n";
result += " (None)\r\n\r\n";
result += "Public Methods:\r\n";
result += " setTimeZone(\"GMT\" | \"Locale\")\r\n";
result += " setFont(\"fontName\",\"Plain\" |\"Bold\" |
\"Italic\",
\"fontSize\")\r\n";
result += " setColor(\"bgColorName\",
\"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(popup) {
var choice = popup.options[popup.selectedIndex].value;
document.clock2.setTimeZone(choice);
}
function setColor(form) {
var bg = form.backgroundColor.options[
form.backgroundColor.selectedIndex].value;
var fg = form.foregroundColor.options[
form.foregroundColor.selectedIndex].value;
document.clock2.setColor(bg, fg);
}
function setFont(form) {
var fontName = form.theFont.options[form.theFont.selectedIndex].value;
var fontStyle = form.theStyle.options[
form.theStyle.selectedIndex].value;
var fontSize = form.theSize.options[form.theSize.selectedIndex].value;
document.clock2.setFont(fontName, fontStyle, fontSize);
}
function getAppletInfo(form) {
form.details.value = document.clock2.getInfo();
}
function showSource() {
var newWindow = window.open("ScriptableClock.java","",
"width=450,height=300,resizable,scrollbars");
}
</script>
</head>
<body>
<applet code="ScriptableClock.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="setTimeZone(this)">
<option selected="selected" value="Locale">Local Time</option>
<option value="GMT">Greenwich Mean Time</option>
</select>
<p>Select Background Color: <select name="backgroundColor"
onchange="setColor(this.form)">
<option value="White">White</option>
<option selected="selected" value="Black">Black</option>
<option value="Red">Red</option>
<option value="Green">Green</option>
<option value="Blue">Blue</option>
<option value="Yellow">Yellow</option>
</select> Select Color Text Color: <select name="foregroundColor"
onchange="setColor(this.form)">
<option value="White">White</option>
<option value="Black">Black</option>
<option selected="selected" value="Red">Red</option>
<option value="Green">Green</option>
<option value="Blue">Blue</option>
<option value="Yellow">Yellow</option>
</select></p>
<p>Select Font: <select name="theFont"
onchange="setFont(this.form)">
<option selected="selected" value="TimesRoman">Times
Roman</option>
<option value="Helvetica">Helvetica</option>
<option value="Courier">Courier</option>
<option value="Arial">Arial</option>
</select><br />
Select Font Style: <select name="theStyle"
onchange="setFont(this.form)">
<option selected="selected" value="Plain">Plain</option>
<option value="Bold">Bold</option>
<option value="Italic">Italic</option>
</select><br />
Select Font Size: <select name="theSize"
onchange="setFont(this.form)">
<option value="12">12</option>
<option value="18">18</option>
<option selected="selected" value="24">24</option>
<option value="30">30</option>
</select></p>
<hr />
<input type="button" name="getInfo" value="Applet Info"
onclick="getAppletInfo(this.form)" />
<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.