Can a DLL plugin inside Internet Explorer at the client side, communicate with Java webservice at the server side?
The DLL is a BHO that captures URL and send it to server in XML format.
Please advice..
A native (DLL) plugin does not execute inside a security sandbox, and can do anything that the host application (i.e. IE) can do ... including connecting to any accessible remote server.
Of course, for this to happen, the user has to install the plugin. (And this sort of thing is why users should be very cautious about installing plugins!)
Yes, web services and XML nicely work with different programming languages, operating systems etc.
Related
I have created a web application using google web toolkit, it works fine launching it from eclipse. I want to put it on my server so I compile it with gwt compile and put the war folder on server. Client works well but the rpc calls return "not found error" on javascript console. I feel like i missed one step: maybe I should launch java server for rpc first, but i don't understand how to do it.
GWT-RPC requires a servlet container: Tomcat, Jetty, etc.
If your "server" is Apache HTTPD, Nginx, Lighttpd, etc. then it's not enough.
An alternative is to not use GWT-RPC so you can code your server-side in another language (PHP, Ruby, etc.) That requires much more work on GWT's client side though.
I have a JavaScript embedded in a website, running in a normal browser, and I have a Java Application running on the same machine. I am looking for a way have both communicate with each other.
I assume that creating files in the local file system from inside JavaScript running in a browser is out of question.
The only way I came up with would be to use a server that both programs can send messages to, and from which they poll for new messages.
Is there any other other way to accomplish this?
A couple of ways I saw in practice:
You Java Application may listen to some local port which your JS will access for instance via XHR. You'll need to mind cross-site scripting (your JS may need to be loaded from that local URL), but this is doable. The easiest would probably be to run an embedded HTTP server.
Your Java Application may be registered as a protocoll handler in the OS. Then JS would open links registered with the application thus sending data to it.
As #PavelHoral is pointing out, CORS is a way to workaround same-origin policy.
JavaScript inside a browser can only make AJAX requests or communicate with browser plugins if they provide some additional JS interface.
Local HTTP connection
One option is to listen for HTTP connections in your Java application (does not have to be servlet).
You will need to handle CORS correctly.
Central server
Other option is to have a central server to which both your JS and Java code will connect.
Java applet
Another option is to have Java applet. When running in privileged mode you can do pretty much anything (maybe you can convert your Java application to Java applet).
You will need to handle applet security here (e.g. signing applet with trusted certificate).
Please refer to this question for direct sockets communications from within javascript. You'll need a HTML5 browser, and likely this won't "just" work or necessarily be a good idea if you want to publish this on the WWW.
How to Use Sockets in JavaScript\HTML?
I know for a Java Program to run on another Computer it needs JRE(Java Runtime Environment). But for a J2EE application (Serlvet-JSP) or Struts2 framework application or Hibernate framework application or any Framework application of Java what are need to Run it Successfully on another computer where it is not developed....
I know JRE is required for both type of Application. and JDK is for developing an application.
I also know that for Mobile application to run on device it needs an Emulator that supports the particular OS (Android, iOS, etc). Just like an Standalone Java Application.
But for running J2EE application is there any other requirements than JRE??
For Example:- I have made a site called SocialMash.com I want to have a working prototype to deliver to user (User meaning like we all use Stackoverflow and other sites). What will I require to configure the site.
I know I will require a server like Tomcat/JBOSS/GlassFish but that all will be on my side (server side/ development side) but Do the Users to use the site will require anything among JDK, JRE, Server, or anything to use SocialMash.com or just URL will be enough?????
You need to have a JavaEE application server. It runs on top of JRE. You can check this open-source reference implementation (full-profile, my favourite):
https://glassfish.java.net/
or if you want to have only web-profile:
http://tomcat.apache.org/download-80.cgi
Web profile is different from full profile in that web profile supports only Servlet-JSP, but not JPA (or hibernate as stated in your question).
Users will not require anything except for the browser in case you write a web application (Servlets+JSP, Struts, JSF, etc. - just give them a web reference). But you can go further than that. You can write a Java SE desktop client for EJB, or SOAP service (they will be placed in full-profile server like Glassfish), and distribute for your customers. In this way they will not require any browser, but your custom desktop program.
Some of the libraries require to be added to your application server and configured manually. Like Struts. In this case you first need to decide which framework/library you would like to use, then go to their web site, and follow the tutorial on its installation.
To host an J2EE application, a webserver is required that has servlet container. servers included in XAMPP/LAMP/WAMPP will do for php based application. But for J2EE application servlet container is rquired which is there in TOMCAT/GLASSFISH/JBOSS.
On the user side, the user sees pure HTML with additional js/css. He does not see the jsp scriplets/servlet code written in your J2EE application. so no java technology is required on the user system. He only needs a browser.
A J2EE project intends to create a web service. In order to run this project on your computer, you need a local server.
Any IDE can provide you a local server like Tomcat or Glassfish, you just need to try to run this project to get these options.
If you don't need to access the code on the other computer, two options:
You compile your project to get a .war file, which you can deploy on your Tomcat server, or any else.
You put this on a server of yours, and share the url.
Assuming that you are in charge of the app hosting:
If that the app is running on your own remote server, you just need to share the app url and your user can access it with his browser (nothing more is needed).
If you run it in your own computer, as localhost, he won't be able to access it, and I recommand the usage of a host like Openshift to make it accessible (that's a free solution).
Is it possible to run a java server application on a web hosting plan such as hostgator.com, or do I have to purchase a dedicated server?
Shared hosting plans do not offer this kind of service. The only things that will run on these are web scripts like PHP (and with some disabled features).
The best option is to purchase a VPS or a dedicated server where you'll have a remote access and on which you will install everything required to run java apps.
You will also have to take care of the security of the server and this is a big responsibility.
What approach can I take to solve my problem such that my Android app hosts a website (on whatever port > 1024) and also features a way to allow/block incoming client. So far i have tried manually opening a ServerSocket and injecting html then closing the socket, however it only works most of the time and only with Google Chrome...anyone have other ideas?
You could use some small servlet container like jetty - pure java and lightweight enough to fit a phone. Then you can register your servlets and maybe deploy complete war archive
Checkout iJetty. They basically ported a fully-functional Jetty implementation to Android. I've used it before both as a servlet container (deploying WAR files to it) and as an embedded server in an application I wrote. Getting it to work inside of another application takes some doing, but can definitely be done. You also have access to the source code so you can modify as needed.