Java application uses AJAX
Basically, it's all HTTP. AJAX is just a fancy term to describe asynchronous HTTP calls made from Javascript. Any HTTP Library will aid you to access the data you need, like the Apache HTTPComponents.
You should take a look at the commons HttpClient library. It's made to be used for programatically making calls to http services.
If you have access to the server part of the application, it would be interesting to consider rebuilding around XML or JSON, better than using HTML and parsing it.
If you don't have access to it, then @Malax is right (+1) and then you should consider using apache jericho for parsing.
Regards, Stéphane
You can establish a HTTP connection to a remote server with a given URL from your desktop client. Here's a small code fragment which demonstrates one way of doing it. The connection uses a session cookie, which may or may not be required in your case.
private void createConnectionToServerWithSessionCookie(String URLStr) throws IOException {
URL managerURL = new URL(URLStr);
URLConnection connection = managerURL.openConnection();
connection.setRequestProperty("Cookie", sessionId);
connection.connect();
managerReader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
}
Also look here for more information
精彩评论