I am using a Linux system for my personal usage. My internet provider had provided a login page, which will help to connect the internet. Once I login, then I am able to connect internet. But I need to login the internet for each and every time after system started.
Internally the login page had implemented the AJAX request to connect the server. I had figure-out the AJAX implementation code through browser developer console.
So, I am planning to write a simple Java code which should internally call the AJAX call and need to login the internet. So, once this code had implemented, I will write a shell script to call to execute the Java class, and I will make this shell script to executable at the time of system start-up.
So, is there any way to call/implement the AJAX call using JAVA standard edition code implementation? I am not asking for code. I am just asking is there any framework or Java method will available to do this one?
Below JavaScript code which I had identified using the FireBug.
function makeAjaxRequest(e, d, a, c) {
var b = getAjaxObject();
b.open(e, a, true);
b.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
b.send(d);
b.onreadystatechange = getReadyStateHandler(b, c);
addOverlay()
}
function checkSubmit() {
if (status != 'LIVE') {
document.frmHTTPClientLogin.mode.value = 191;
if (validateLogin()) {
UserValue = replaceAll(document.frmHTTPClientLogin.username.value, '\'', '\'\'');
queryString = 'mode=191&username=' + encodeURIComponent(UserValue) + '&password=' + encodeURIComponent(document.frmHTTPClientLogin.password.value) + '&a=' + (new Date) .getTime() + producttype;
if (loginstate != null) {
queryString += '&state=' + loginstate
}
url = 'login.xml';
makeAjaxRequest('POST', queryString, url, loginResponse)
}
} else {
if (document.forms[0].btnSubmit.value == logoutValue) {
document.frmHTTPClientLogin.mode.value = 193;
queryString = 'mode=193&username=' + encodeURIComponent(document.frmHTTPClientLogin.username.value) + '&a=' + (new Date) .getTime() + producttype;
url = 'logout.xml';
makeAjaxRequest('POST', queryString, url, logoutResponse)
}
}
return false
}