HI,I have created a web server using NodeJS. At the server side, i have
string of numbers (2,3,4). I want to convert it to Array object at the
GWT object. I was not able to do.So was trying to display simple text message at GWT using the following code:
Window.alert("Connecting to server");
String Strurl = "http://127.0.0.1:1337/";
RequestBuilder builder = new RequestBuilder(RequestBuilder.GET,
URL.encode(Strurl));
try {
Request request = builder.sendRequest(null, new RequestCallback() {
public void onError(Request request, Throwable exception) {
// Couldn't connect to server (could be timeout, SOP
violation, etc.)
}
public void onResponseReceived(Request request, Response response) {
if (200 == response.getStatusCode()) {
// Process the response in response.getText()
Window.alert(response.getText());
}
else {
// Handle the error. Can get the status text from
response.getStatusText()
}
}
});
Window.alert(request.toString());
} catch (RequestException e) {
}
Got the 'Conecting to Server' alert message but do not get the alert
message inside the RequestBuilder call back.
Below the javascript code of Nodejs
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.write("From node js");
res.end();
}).listen(1337, '127.0.0.1');
How can i get the data at the GWT side from NodeJS server javascript code ?Thanks
HI,I have created a web server using NodeJS. At the server side, i have
string of numbers (2,3,4). I want to convert it to Array object at the
GWT object. I was not able to do.So was trying to display simple text message at GWT using the following code:
Window.alert("Connecting to server");
String Strurl = "http://127.0.0.1:1337/";
RequestBuilder builder = new RequestBuilder(RequestBuilder.GET,
URL.encode(Strurl));