0

I am trying to fetch the whois information for a domain name... i was able to solve it using java socket connection but as it comes to the mozilla firefox extension is there any way to connect to the whoisserver and fetch the whois information i dont want to use any paid or already built webAPI i just want to connect to the whois server of the respective domain name and query for the whois information and fetch information......

Is there any way to call my java whois API through the firefox extension????

Thanks..

Nishit Jain
  • 1,549
  • 8
  • 21
  • 33
  • 2
    Mozilla extensions are written in Javascript. If you want to implement the actual WHOIS query in Java, you'll have to run it as a web service and have your extension query that service. – Philipp Reichart Dec 20 '11 at 14:51
  • I have created the Webservice in java using netbeans and Jboss application server now i want to know how can i Query the webservice function via firefox extension – Nishit Jain Dec 28 '11 at 10:34

1 Answers1

0

JavaScript is specifically forbidden from making “raw socket connections” that would make this possible. JavaScript can only access HTTP, FTP, or (rarely) some other resource-fetch-only protocols.

(Note that the streaming sockets features of WebSockets are based initially upon doing an HTTP handshake, and then going to the “almost raw” sockets mode; but this was designed to intentionally prevent connecting to arbitrary services. One of the fears was that, e.g. a spammer could hijack web browsers to connect to SMTP servers and relay mail using random users' machines as springboards.)

However, Firefox extensions can access the XPCOM layer (XUL) — through the JSLib system. Specifically, the socket class is found here: http://www.mozdev.org/source/browse/jslib/libraries/network/socket.js?annotate=1.6

It looks like a pretty good asynchronous interface, similar to the select/read loop that you might use in a single-threaded C server implementation. (Remember, JavaScript is all single-threaded…)

Alternatively, although slightly less portably (in today's world), you might be able to download a Java applet with your code in it, but:

  • applets are forbidden from connecting to arbitrary systems, without special permissions, which I don't know how to / if XPI's can provide;
  • many Firefox users don't have Java installed; it's not even available on some platforms that Firefox runs on.
BRPocock
  • 13,638
  • 3
  • 31
  • 50
  • +1 for the response. The best way to accomplish this task is to built your own interface to the WHOIS servers and create an extension that calls your interface via HTTP. – Simone Carletti Dec 21 '11 at 13:10