I am using jsoup to make an http post request to login into this page: https://home-access.cfisd.net/HomeAccess/Account/LogOn?ReturnUrl=%2fhomeaccess%2f
try {
Response r = Jsoup.connect("https://home-access.cfisd.net/HomeAccess/Account/LogOn?ReturnUrl=%2fhomeaccess%2f")
.data("LogOnDetails.UserName", "s650665")
.data("LogOnDetails.Password", "kai66wen").data("Database", "10")
.method(Method.POST).timeout(10*1000).ignoreHttpErrors(true).execute();
cookies = r.cookies();
response.getWriter().println(cookies);
response.getWriter().println();
} catch(IOException e){
System.out.println(e);
System.exit(0);
}
Connection connection = Jsoup.connect(url);
for(Entry<String, String>cookie : cookies.entrySet()){
connection.cookie(cookie.getKey(), cookie.getValue());
}
response.getWriter().println(connection.ignoreHttpErrors(false).followRedirects(false).userAgent("Mozilla").referrer("http://www.cfisd.net").get());
The above code works just fine when compiling and running in a regular java project within eclipse. But as soon as I transfer this code into the Dynamic Web Project I have setup (With Tomcat server), it does not carry out the http post request properly and does not log in. I am placing the above code in the doGet method of my servlet file in the Dynamic Web Project. Any advice or help is very much appreciated.