0

sorry if my question in trivial but I'm wondering if it's possible to programmatically interact with an applet, reading the output it provides (a sort of web-scraping).

Assuming a certain website expose an applet, would it be possible to extract content from it through POST/GET requests (or other similar means) in a programming language like Java. My interaction is "black box like" as I have no access to the server environment.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
elbuild
  • 4,869
  • 4
  • 24
  • 31
  • One option is to behave like an applet, but I assume that requires that you know how the servlet/applet work. http://stackoverflow.com/questions/4349854/calling-a-servlet-from-a-java-application – Kiril Nov 27 '12 at 20:39
  • *"a certain website"* Care to share an URL? – Andrew Thompson Nov 27 '12 at 22:04
  • no, it's an italian website. No commercial value involved...just trying to make some money on our overcomplicated government rules providing accessible content to mobile users. – elbuild Nov 28 '12 at 18:18

2 Answers2

0

Not sure what you mean. An applet is a Swing application running in the context of a browser and when you "hit" a URL for an applet the browser actually downloads the corresponding jar.
But there are ways to "manipulate" the applet and e.g. press a button or get a value programmatically and that is what automated UI suites do. I don't know how they do it though to be honest.Seems like a decompile and analysis on the fly

Cratylus
  • 52,998
  • 69
  • 209
  • 339
0

Not sure if communication through JavaScript works for you, but you can call any public method in an applet from JavaScript like this:

<applet name=myapplet ...> </applet>

Your applet may have a method like this:

public String returnAString() {
return "this is a string";
}

So to get a value back from that method, you would call it like this:

var stringFromApplet = document.myapplet.returnAString();

You can also make calls from an applet back to your JavaScript like this:

getAppletContext().showDocument("javascript:myJavaScriptMethod()");

Chris
  • 55
  • 1
  • 5
  • I ended downloading the jar and decompiling it via JAD before reverse engineering all the Applet. It was really funny, and I learnt a lot in the process (a lot of black magick since the content was heavily obfuscated). Thank you for your time, I appreciated your effort.. – elbuild Nov 28 '12 at 18:16