public boolean isGood(String path)
{
if (p != path)
{
good = false;
}
if (good)
{
try
{
Connection connection = Jsoup.connect(path);
Map<String, String> cookys = Jsoup.connect(path).response().cookies();
if (cookys != cookies)
cookies = cookys;
for (Entry<String, String> cookie : cookies.entrySet())
{
connection.cookie(cookie.getKey(), cookie.getValue());
}
Doc = connection.get();
good = true;
}
catch (Exception e)
{
rstring = e.getMessage().toString();
good = false;
}
}
else
{
try
{
Response response = Jsoup.connect(path).execute();
cookies = response.cookies();
Doc = response.parse();
good = true;
}
catch (Exception e)
{
rstring = e.getMessage().toString();
good = false;
}
}
return good;
}
This method is not right. What I'm trying to figure out is a way to without know what cookies will exist, be able to handle cookie changes as well as maintain sessions.
I'm writing an app for my simple machines forum, and it changes its cookie config as you click around for some custom behavior.
But if the app does well for my site, I was going to publish a version for others to use for other forums.
I know I'm heading in the right direction, but the logic is kind of kicking my butt.
Any advice would be greatly appreciated.