Alternatives to browser for Java EE applications? - java

My client wants a Java EE application server but doesn't want to access it using a web browser. They don't want to have the "web page" look but rather something like a stand-alone client.
I don't really know how to do it or even what to google.
I was considering defining a Swing client reacting to web services but I don't really know if this is the best way to do it.
I don't want something like RIA.
I guess my question is "how to build a Java EE client outside a web browser?"

GlassFish allows for having a thick "application client" started with Java WebStart which has easy access to the various things like EJBs inside the server while running on the client.
This might be what your client wants?
http://netbeans.org/kb/docs/javaee/entappclient.html
http://java.sun.com/developer/technicalArticles/J2EE/jws-glassfish/part2.html
I've found the Glassfish 3.1 server very easy to work with as a deployment platform on both Windows and Linux.

This is not so unusual. Define your service interface and expose as EJB's. Create your client (GUI) via Swing, Eclipse RCP (http://wiki.eclipse.org/index.php/Rich_Client_Platform), or other RCP technology. Your client(s), possibly running on multiple workstations, will communicate with centralized services via the EJB client interface.
See http://java.sun.com/developer/technicalArticles/J2EE/appclient/

Related

Developing app with web and Android client with Java

I'm going to start developing a new simple "X management" kind app, like contact management or events management. What I want to know is which tools would be the best to achieve it in the way I want.
My app needs to be a web app running on a server that has a mysql database to save and retrieve some simple information. This app must have a web client but I want it to be able to be extended to work with an Android app client.
Things I've thought:
I've worked on Java with facelets and JPA travels management app running on a GlassFish server on localhost with a JSF web view, so maybe my web client and the full app could be done with this.
I've worked with web services such as SOAP and REST with Jaxb and xml schemes to retrieve information parsing some webs into xml or json to show on a client .net app. So I've thought I can add to my app, like last topic we talked about, a REST web service layer to easily work as I want, or at least I think it would be easy. If I do this the Android app could share the same app core code but using the REST service.
My question is what could be the best way to do an app with 2 client side in different platforms that could share some code to be easy to extend it moreover to a desktop app. I've talked about these 2 options because I'm a students of computers at university and those are the tools I know, but I can easy learn more. I've also think about just a REST service and create a web and an Android client to work on same service or something like that.
This post is getting long, so here is the summary: What technologies and tools do you think are the best choice to create an java web app that needs to have web and Android client? Also what server, like tomcat, GlassFish or another, should I use? And what about persistence layer? JPA with mysql is the best I know to work with.
Thanks a lot.
P.D: I work with eclipse
From my point of view:
You can use java jersey and java spring both ( java spring as Dependency injection) for creating RESTful Web service. So, In server side you will create endpoint and you can access data from any platform through those endpoint.
Server can be anyone. It's up to you. I always try to use tomcat but tomcat is not a full JavaEE container it's only a servlet container. So if you want to use full JavaEE version then you should use Glassfish.
And yes JPA .It can be easily used in any environment supporting JPA including Java SE applications, Java EE application servers, Enterprise OSGi containers etc.
On the other hand, still choice is yours.

what is the role of apache server in java swing application (3 tier)?

I have made a Java Swing application, in the GUI the user can select the type of element and choose a date then the element's informations will be shown on a JTable.i used easyPHP to create the DB.
so what is the role of apache server in this case!
can i consider it like an application server ?
A Java swing application (AFAIK out of the box, for alternatives see below) is not available over HTTP/S (and is therefore not classified as a web application) and Apache is a web server (with features such as proxy, TLS terminator etc.). Therefore there would be no need for a web server such as Apache to front your Swing application.
Apache web server is not an application server for a Swing application per se. Although it can run applications in different programming languages such as php through loading of modules. It however does not run Java web applications.
An application server in a Java perspective would be Tomcat, Glassfish, JBoss, WebLogic etc. An application server hosts an application and could provide a set of services such as Naming, HTTP processing and so on.
Perhaps you are referring to Apache Tomcat instead of Apache Web Server. If so, you would be right on the mark as that is an application server for Java web applications.
If you would like to make your application available through HTTP and enjoy the myriad and expansive benefits of an application server, I would recommend you to rethink on using Swing and utilize a technology built over Java Servlets such as JSPs, Spring MVC and so on.
If you would still like to make the Swing application available through a web server (through HTTP/S) there are some solutions out there but I have not tried any of those. Please do a search on "Swing available on HTTP" in that case. I have also provided a link as well.
You can read up on Application Servers on this wiki link.
You can read up on an HTTP end point for a Swing application here.
This Apache is not used in your application. You installed easyPHP so Apache comes with that to provide PHP programming environment.
Moreover Apache is a web server. So any web based application can be deploy here. PHP is a web programming language sot it requires Apache or any other web server.
But your application is standalone developed with JAVA SWING. So you can stop Apache server and check everything is running fine or not.

Host a web-service from within a Swing application

I have to set up a desktop Java client that will communicate with a .NET desktop application. The .NET application exposes its services through a webserver of its own. Rather than have my Java app frequently poll it for data changes, it was suggested that the .NET app contact my Java desktop app via a webservice or similar technique. I am not familiar with web services, but as I understand you would need some sort of web app container such as Tomcat to host it.
Is there a way to set up a listening socket in my app as a webservice end point without effectively rewriting a webserver from scratch?
Alternately, are there other or better ways for a .NET desktop application to talk to a Java Swing desktop application?
If you are using JRE 6 then you can use the Endpoint.publish() method to create an in-app server and expose a service.
Refer the simple tutorial in the link to see an example of the same.
How the Endpoint.publish() works is it internally creates a light weight server and makes the SOAP service available on that location.

Standalone Java application with HTML front end

I want to develop a standalone java application, with web browser as front end. This application will run locally and won't be making any remote server calls. I'm essentially using java, as web-browser cannot perform file operations.
I want this application to be portable: no need of installation. Just copying a folder should be enough. I want to know how it can be done, how will javascript communicate with java code.
In continuation of #Quentin's answer.
Yes, you need web server.
There are 2 principal architectures:
Create stand alone application with embedded web server
Create ordinary web application and run it on proprietary web server.
IMHO I think that the second approach is better, however it strongly depend on your application functionality.
You can take jetty or grizzly as a web container. Both can run as in embedded or stand alone modes. You are welcome to share other details of your application with the community if you need concrete advises concerning to the design of your application.
The application would need to implement an HTTP server. Then all communication would be done over HTTP.
Write a small web application as you need and Deploy it using Jetty. Jetty is a pure Java-based HTTP server and Java Servlet container. You can use it by embedded mode also.
Deployment is so easy if you use Jetty-Runner
java -jar jetty-runner.jar my.war
You don't need a local web server. Take JavaFX (embedded webkit) and implement a URL protocol handler for say "myprotocol". Then you can access it from the browser using something myprotocol://xxx.yyy.zzz

Processing web requests in Java desktop application through tor network?

I write Java desktop applications sometimes and sometimes I would like for my web requests to be processed through the tor network.
How can I go about configuring this properly in Windows and/or Linux?
Have a look at the netlib library to push all your JVM traffic through TOR.
I think you have to using Web Service technology. Web Service is independent technology and by it can connect several application with different technology together. For example you can develop server with .Net platform and develop client with Java,Php,Python or others (or vice versa). Web Service in java has JADX-RPC(older) and JAX-WS standards.

Categories

Resources