8

Lately I have been playing around with Java's ScriptEngine API, namely the javascript engine, which uses Rhino for everything.. I sumbled upon the fact that Rhino has no XMLHttpRequest. I was wondering if anyone knew of a possible way around this?

Steven
  • 1,709
  • 3
  • 17
  • 27
  • Using XMLHttpRequest is a good idea because it's familiar to most people who use JavaScript, but it's not actually necessary in Rhino. You can use any of the Java network classes directly (in fact, that's how you would implement XHR in Rhino). – Matthew Crumley Dec 21 '12 at 14:04

1 Answers1

14

You practically need to define XMLHttpRequest in Java. And it is already done - check this out.

Adrian Ber
  • 20,474
  • 12
  • 67
  • 117
  • 2
    See http://docs.oracle.com/javase/6/docs/technotes/guides/scripting/programmer_guide/index.html, section "Importing Java Packages, Classes" – Adrian Ber Dec 21 '12 at 15:27