Background Information:
The organization where am working uses Java, Oracle ADF framework,Oracle db/weblogic server stack.
New Requirement
I have this tricky requirement for a new project to make the web application that I am building on to work offline also. As per the requirements a user should be able to click on a 'Work offline' button while in the 'online' mode and be able to get a local copy of the application/or page to their device.
And once the user complete the data entry in the offline version of the application downloaded to their local device, then the user should be able to click on a 'Submit' button and upload the local details to the server (ie. to the main production server. And it is to be done when there is internet connectivity).
The solution am trying to proceed with is as follows:
I build a std web application to work on the production online mode.
It will use ADF or /JSF with Oracle db.
I will build a simple application for offline mode which will reuse
most of the pages developed for online mode. But the database use
will be a lightweight one like hsqldb. And the whole application
will be bundled with a lightweight server like jetty.
The whole offline application and server will be bundled together as
an executable jar which can be downloaded and run from any device.
The local offline version of the app will have a 'submit' button.
And on clicking this button when there is internet conectivity then
we will make a webservice call to the production server, and submit
the data collected
My Questions :
Will my proposed solution work ? ...is there a better way to do this?
Is hsqldb the best lightweight embedded database for offline mode?
Is jetty a good lightweight embedded web server?...is there a better
one ?
Can an executable jar be run on any device like
mac,ios,linux,android,windows etc.
The approach I have followed is as follows:
I built my web pages UI with angularjs inside a normal html5 page
and hosted it on my weblogic server.
I wrote a appcache.manifest file for the html page describing all
the css/js/image files used by the application. So that if the page
is once loaded on to a browser then the page will be cached on the
browser.
I created restful services for exchanging data to my html page from
server. The data was passed in the json format and I was encrypting
the json payload using AES encryption. At the client side I used
cryptojs library to decrypt the data provided by the rest service.
how does cryptojs works
I used pouchdb javascript library for storing data provided by the
user locally onto the in browser database(pouchdb store data to indexedDB in case of chrome and firefox, it store data to webSQLDB in case of safari and other brwosers).
You can use ADF Essentials that is supported on GlassFish for the offline version.
(This will also reduce your license cost). You could use an Oracle XE database for the offline version. http://www.oracle.com/technetwork/developer-tools/adf/overview/adfessentials-1719844.html
Related
I have a dynamic web project in eclipse. It has html files, Css file, js files, java files, jsp files, and etc. It also is connected to an oracle database, which the dynamic web project inserts, updates, deletes and shows data into webpage. The web project works fine in eclipse IDE, and can run it on the external web browser.
I need to take the dynamic web project and put it on the desktop, such as a shortcut icon. So, i want to be able to open the web project from the desktop and be able to run directly on the web browser, like chrome. The reason is I need to send that web project to other users to test, and see if what changes needs to be made. The users do not have eclipse on their systems. Is there a way I can send them the app. as a desktop application?
If not, Can anybody help me on how I can do it on my local system?
For the run of web_application with some jsp-files you need to have one servlet container as Tomcat or Jboss, Wildfly e.t.c. This container must be for you available over the network ( mayby official IP-Address is necessary). Then you can access to URL of your web-application with your local browser and observe the work of your application. With the icon and one link you can start the web browser with your required URL too.
I'm not sure how one goes about using EasyPHP Webserver. Looking around the internet there doesn't seem to be a lot of materials on the matter. Whenever I try to run a php file from the www folder, a new blank tab appears without output from script code (Simple hello world echo). I'm not sure what the problem could be. My Http server and db server is running.
I'm also not sure if EasyPHP devserver is capable of going online. I'm currently in the middle of building an application that requires information to be sent to the server. My android application has been having trouble connecting to the EasyPHP devserver. Will I have more success with EasyPHP Webserver than I will with Devserver?
If you can make a success request using browser, then I think there will be no problem in Android.
Try to debug your webservice using tools like RestClient or PostManager.
Also, when connecting to webservice from Android application, I suggest using third party library like retrofit2. It's quite simple and we will never bothering with parsing json anymore.
In order to get the devserver running, you simply have to right click on the tray icon and select "Open Dashboard". There you can enable and set up all the services such as modules that you need. Please note that EasyPHP devserver is not designed to be used for a production server!
For performance and security reasons, I do strongly recommend to use Apache or nginx with the current stables of PHP 7.0.x and MySQL. If you need some help with that, feel free to ask me in a comment.
EasyPHP Webserver or Devserver are not a web server. It is a manager that installs Apache, PHP, MySQL, and other utilities, just like WAMP or XAMPP.
Just be sure to start the application that loads the Apache server before doing anything.
about your Android device connecting with the server, I'm not sure how that could be done, I have been more lucky using node, gulp and some scripts to generate a web server that is accessible to my devices in my local network.
I am currently working on a point of sale application.
we have a existing system based on java which uses javapos to integrate with the devices (such as receipt printer, cash drawer , MSR etc).
now we are trying to port the java based thick client to service enable , so it is set to become a web app backed by html5 and spring webservice
my problem is to integrate the devices to the web ie browser so that the cashier can access the point of sale application from the browser .
how do i integrate the devices to the web app now. one option i have is deploying a java component in the register and make it communicate it to browser via websocket.
browser<-> websocket <-> java device component in local system
Is there any better way to do this? i need the technology which enable me to do the same.
i have considered the applet as well but the problem is the local java component is kinda huge and it will have different device drivers for each system.
JavaFX offers a pretty decent web browser component, that allows easy communication between the Javascript code that runs in the page and the Java code outside. You could port your application so that:
It uses JavaFX, openning a window with just a browser component and pointing it to your web application
Implement the web app as normal - it will display in the browser component
Move the device-specific Java code in the JavaFX app, expose its methods to the browser; now the Javascript code will call Java and (hopefully) you will be able to reuse most of your existing code, excluding UI code of course
A "Hybrid" JavaFX/HTML application example is iBreed (it is a framework that you can use actually).
I think you can make it work, but you will need one more piece of software.
Webserver (hosting the HTML-files and API)
Client PC (runnning the HTML-frontend in a browser) woth conected devices
new service running on the client PC, with a Web-API for the connected devices
I think, this is exactly the same approach as you mentioned with websockets. (Ony for older browser).
Take a look at atmosphere. This may help you to get the websocket stuff done:
https://github.com/Atmosphere/atmosphere
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).
I have built a java web application on Eclipse. But i am naive in terms of making an application live i.e. deploy it online. I have tried using Cloudbees, and succeeded in deploying it at run#cloud there, but could not see it actually running. I haven't purchased any domain name as of now, therefore I would like to try it on any free domain first. If I want to make that application live, what would be the exact steps that I'll have to follow ?
Use Redhat Openshift Cloud...
Redhat Openshift is a Cloud based service which provide PAAS(Platform As A Service) i.e. Use their Server and upload our Project.
Redhat Openshift also provides MySql , Postgre and MongoDB.
It Easy to understand, Simple to Configure and Auto-Scalable.
Redhat Openshift supports:
https://dl.dropbox.com/u/24576260/Redhat%20Support.png
There are alternatives of Redhat Openshift - Google App Engine (GAE). But GAE restrict some of the class usages in Trial Verison.
Whereas Openshift have kept open and whatever user wants he can use and configure it.
Try Jelastic.
They have a free trial as well.
PS: Works for me each time.
If you have deployed successfully to RUN#cloud then your app is already running; there is no need to purchase a custom domain. If you log in to https://grandcentral.cloudbees.com/ and click on the Apps tab, you should see your new application listed; the show in new window link will open the live web page. (This will be http://appid.accountid.cloudbees.net/ where appid is whatever you chose when creating the app, and accountid is rishabh85 or whatever your CloudBees login name is.)
You can also load this page directly from Eclipse, if using the CloudBees SDK (use http://eclipse.cloudbees.com/ to download or http://blog.cloudbees.com/2012/07/getting-started-with-cloudbees-and.html for more information). Configure your account information, and open the CloudBees view (available from the CloudBees toolbar button), and you will see your running apps. A context menu item lets you open the selected app live in a web browser.
Try Google app engine. You can deploy your Web applications and you ll get a free sub domain.
As I have small knowledge of working like this, its very easy. This is to inform you that its works like your own pc. In my last company they had a Windows server.. and Tomcat & MySQL was pre installed on that server. I just place my .war in the proper place & imported the blank DB.. and its starts working :)
Checkout my blog posts on creating a web service from scratch using Cloudbees. It's a series of 7 posts that have everything you need in order to get your service up and running (including an opensource code base with almost everything you need already integrated)
If you just want the fastest way, checkout this youtube video.