I am trying to program a Thunderbird extension, in which I want to use features from certain java libs. But because the TB extension is written in pure javascript, I can't figure out the best way for these two technologies to communicate.
I was thinking about something like sending an ajax request from TB extension, catching it with java server code and then responding to it. I know how to work with ajax and mainly intrested in "java part" of this problem. I'm aware that, this can be solved by catching request with servlet, but I want to know if there is any solution with "pure" java.
Can anybody tell me if it is possible, or even show me some example code?
Writing an extension isn't just writing Javascript, you'll be dealing with Mozilla's XPCOM API. There is an active Mozilla project for using Java to communicate with this API. See here: https://developer.mozilla.org/en-US/docs/JavaXPCOM
Related
Disclaimer: If there is a similar question, I haven't found it and I apologize.
The thing is, I am in the middle of a hackaton with an inexperienced team. I am familiar with java, but there for frontend and they work in java. The thing is - nobody knows how to connect frontend and backend of a web app which we have to build.
Is there a way to make java communicate directly with javascript, maybe through a library or java class? I am asking that because we want to design a web app only in CSS/JavaScript.
If there is no way, could we make an invisible Java Applet which would be a "medium" between java and javasript, but does not require space on the page or interfere with design in any way?
I apologize again if the question is a closed discussion, or just plain ignorant, we're note here to win, but to learn without completely disgracing ourselves :)
Typically you would define a REST endpoint in Java, then communicate with the Java using an AJAX call from the Javascript.
I'm writing a web server by Java. This server is just to use socket to get the connection from client, parse the request and call the corresponding handler to handle this request. But I want to make a page using Django. However, I don't know how to run python script when the server get the request, and Django site tell me that it can be used in Apache by wsgi, so I guess I can do it as well, but how to implement it?
To get a good idea of what is WSGI you can read the official documentation (PEP-333). But basically WSGI is a big hash table that you pass to your WSGI application.
Since you are writing your server with Java an important part of your project will be to figure out how to call python code from inside your Java code.
But if you avoid writing this Java web server, you can tale a look at other tools that will give give your a better support to run your python WSGI app.
Apache with mod_wsgi
Mongrel2 with wsgid
Nginx with gunicorn
Good luck!
It is a bit confusing as to what you are really after. If you want to run Python WSGI applications, including Django on a Java server, then look at Jython and modjy.
http://opensource.xhaus.com/projects/show/modjy
I am learning to build Chrome extension and I have an idea to build something which requires complex computation (using many java libraries) which seems hard to be implemented by JavaScript.
A general architecture I have in mind is:
Chrome Extension (GE) extracts HTML elements and feeds HTML elements to Java application as input. Java application does the complex computation, and then feedback the results to GE. GE finally renders the results into the browser.
Does anyone know is this feasible? Does this have to involve a server architecture? Could you also refer me to some further information?
Note: It is a Java application, hopefully you can give me some Java specific answers.
Thanks in advance.
You would need to create java web application running on server (which can be accessed via URL) which you will be communicating with through ajax requests. Chrome extension (or any other js app) doesn't care what's running on server - java, php, or something else. It just sends HTTP POST/GET request to provided url and receives response back.
If you are asking if you can pack some java into your extension then the answer is no. You can pack some C++ though.
I have a search engine which is implemented in Java. It's very complicated. I want to use a dynamic interface for the client so I guess I should go with AJAX. I absolutely don't know NOTHING about PHP, nor AJAX and this is my first web project but I have to do it ASAP and I'm seeking to learn how to do it as fast as possible. I want my page to send the query to the Java engine, and after processing the Java code should return the result to the page.
Thank you for your help.
GWT (Google Web Toolkit) is probably the fastest way for a non-UI Java guy to build a complex, ajax-enabled, dynamic UI.
As it seems you are already familiar with Java, why don't you use Java Server Pages (JSP) to build the web project? Here is a guide to getting up and running.
I have just been looking at the GWT and i am impressed by what i have seen but i do not really understand how it is used to when creating web applications.
For example, when im programming in PHP or JSP creating a simple app that lets users register, adds the detailes to a database and then allows them to login is pretty simple but i was wondering how GWT does this?
When doing this in GWT, would GWT widgets be used to construct a frontend(client) that accepts user input and then sends it to a server which is written using pure Java, the Java then does all of the data processing and database interfacing?
If my understanding is correct, is GWT just a way to write javascript frontends in an easier way?
Have you looked into the GWT Overview? I think this line explains it the best:
The GWT SDK contains the Java API
libraries, compiler, and development
server. It lets you to write
client-side applications in Java and
deploy them as JavaScript.
Basically, you write your code in Java, all the while using the GWT to create complex UI's, etc. When you "compile" it, it is highly optimized JavaScript that translates well to multiple browsers, including web platforms.
Whatever language you want to use server-side does not matter - ASP.NET, PHP, etc - it will all work with GWT because GWT is, ultimately, JavaScript.
Basically, Google is trying to make it simple to develop web applications in a familiar language, and doing all the underlying work for you. I'm sure there is someone else who can further expand on the capabilities and advantages of GWT, but I hope this helps!
Exactly. "In the end, it's just JavaScript", you can "Use the backend language of your choice"