Retrieving data from an embedded web page
Hey all, I've just started learning Java and I've got an idea for a first project that would be functional for my work. I want to display a web page within a Java applet, and then retrieve data from the current active page.
I've managed to get a web page to display using SWT (found some demo code that does this). But I've got no idea how to retrieve data from this page.
I have also found some code that will retrieve data from A webpage and return it within a variable, BUT, The page I'm accessing is an existing application that requires PKI login and various other actions, so the page I want to grab data from is a long URL that I wouldn't be able to access in this way.
This is why I need to embed the page and grab data from the current active page. Hope this makes sense, has anyone got any ideas how I can do this?
In case it helps this is the code I've got for embedding the page -
Quote:
import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.browser.*;
import org.eclipse.swt.layout.*;
public class embedtest {
public static void main(String [] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
shell.setText("WebKit");
final Browser browser;
try {
browser = new Browser(shell, SWT.NONE);
} catch (SWTError e) {
System.out.println("Could not instantiate Browser: " + e.getMessage());
display.dispose();
return;
}
shell.open();
browser.setUrl("http://webkit.org");
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) display.sleep();
}
display.dispose();
}
}