hey, i am currently in the process of writing a thunderbird extension. to write it i need to be able to link java to javascript using a local server, but i am having serious problems linking them.
all i want the java to do at the moment is to get a random number, pass it to javascript which then puts that number in an alert dialog box all using a local server.
this is the code for the java file which compiles fine:
public class IntelligentSendBackend extends Thread{
Socket c;
static int PORT = 9876;
public IntelligentSendBackend(Socket s) {
c = s;
start();
}
public static void main(String[] a) {
try {
ServerSocket s=new ServerSocket(PORT);
while (true) {
new IntelligentSendBackend(s.accept());
}
}
catch (Exception e) {
}
}
public void run() {
try{
BufferedReader i = new BufferedReader(new
InputStreamReader(c.getInputStream()));
DataOutputStream o = new DataOutputStream(c.getOutputStream());
try {
while (true) {
String s = i.readLine();
if (s.length()<1) break;
if (s.startsWith("GET")) {
StringTokenizer t = new StringTokenizer(s," ");
t.nextToken();
String p = t.nextToken();
if (p.startsWith("/IntelligentSend")) {
String msg =
p.substring(p.indexOf("?msg=")+5, p.length());
o.writeBytes("HTTP/1.0 200OK\nContent-Length: " + msg.length() + "\n\n");
Bookmarks