Desktop & mobile web application with offline handling - java

I am evaluating different approaches to building a web based application which handles offline disconnection gracefully. The intention is to create a desktop/tablet UI and a separate mobile UI for the app, backend functionality would be implemented in Java. In principle, the components are mostly there; HTML5 offline seems to have wide support and works well while Web SQL has enough support (Chrome, Opera, iPhone & Android) that we could work with it for offline storage.
As regards creating the UI, it would be nice to use some of the nice JSF libraries out there (Primefaces looks quite nice for example although I've never used it in production). So far, I can't think of any way (and I can't see anything mentioned) of using either HTML5 offline or web SQL in a JSF app. Has this been tried? Is there any methodology/framework that might help here?
I'm also not averse to using client side frameworks. I was very impressed by Dojo for example but then found that it didn't render well on Android with webkit so that ruled it out of use for the tablet scenario. I can probably make jQuery work but I find it to be very fragmented (for example, getting an accordion to handle resizing inside a layout frame just put me off). Finally, I looked at GWT; I wasn't keen on the complexity of getting offline to work and the support for web sql seemed to be a work in progress (no slight intended to the developers, it just seemed to be at an early stage).
So, given the requirement for a web app that runs on desktop/tablet (android) and also on mobile (Android & iPhone) and which handles offline, how would you approach things?
Thanks,
Phil

Related

How to create a desktop app for the existing web application?

Well, I've tried to do some researches before creating a question but only a little has been found.
Basically, I have got a Spring-based web application. Apparently, you can navigate through web application using HTTP requests and URLs. If you want to edit a user you do a GET request /users/edit/{id} and a new page appears. Then you make some changes to the user and do a POST request /users/edit/{id} and let's say the main page appears.
So, now I need to create a desktop application which can do the same things.
Do I need to rewrite the whole app to port it on the desktop? Is it possible somehow to do sort of HTTP requests from the desktop app to the server, then get a response and process it? Or perhaps there is a proper way to do it?
I feel like it's a big topic but I only need you to point me in the right direction as I'm lacking experience in creating both desktop and web applications together (I'd say, I have never ported app from web to desktop and vice verse).
Earlier I created a few apps using JavaFX and I want to use it again as my GUI platform for the desktop app.
You can go for a solution like, Electron.
It's a framework for creating native applications with web technologies like JavaScript, HTML, and CSS. It uses Chromium and Node.js. You can develop your desktop GUI applications using front and back end components originally developed for your web application.
I'm just pointing you a way. You can look in to this solution and it's also open-source.
If you were about to develop the frontend from scratch I'd recommend you to use something like Ionic Framework where in the latest beta 4 allows you to write once run everywhere (web, PWA, desktop with Electron, and build native build for iOS and Android).
Basically Ionic is an Angular 7 library/superset that allows you to create mobile apps based on a webview. This webview can be embedded and run on any device in a native way.
Even though the same codebase can be run on multiple devices you can customise the look and feel on each platform and access through Cordova, Electron or Capacitor the native device capabilities and hardware.
If you don't want to rewrite the web client, you can use any desktop framework with the preferred language you want. Any modern language/framework will allow you to make HTTP requests against your backend and get the data through your API.
Honestly, nowadays I'd day that JavaFX is not the best option out there and I'd recommend you to go through the web-based approach.
Good luck!

Headless browser on android supporting websockets?

Well I'm working on a project which requires me to do a couple of automated things on a website. Its all working good. I've setup WebView and binded JS interface with Java on android to communicate with it.
It works great. But it is really ugly and painful. Also, I'm making WebView full screen and invisible in a service (I need to do that in background). The reason is that the project I'm doing uses websocket to make a request. So I cannot simply GET/POST with Java.
Moreover, the javascript used by the website is too complicated to deobfuscate and scractch out the API used by websocket to communicate (it just shows Binary OPCode 2 in Frames tab in chrome debugger)
So what I'm getting to is, is there any easy way to go headless on android which supports websockets?

Converting responsive web app to Mobile app?

I have my responsive web application in place which works across all browsers. Now i am planning to work convert it into
mobile application. Did some googling and can think of below ways to come up with mobile app
Approach 1 :-
Can be done with the help of WebView (which actually will work as thin wrapper)
Approach 2 :-
Native App:- . Develop Native app. Now, If I need to develop the native , Can i use existing backend java code for Android/IOS/Windows platform or do i need to make modifications in that ?
If yes will these modification vary per platform i.e. Android/IOS?
For User interface, i believe i need to develop altogether separate views. Is that correct ? If yes will there be separate views for android and IOS ?
If your backend java code is sitting on a server behind some sort of API (REST etc.) then it can be used by both applications.
If you are developing natively for both platforms then you will need separate views. There are however solutions for developing for both platforms using a single codebase see: Xamarin Cordova

What is the alternatives for Java Applet to launch client programs using Chrome browsers?

I am working in a web application using ASP.net and C#.
My target is to check on a desktop application on the client machine .. If it was exist then I should launch it. Else if it wasn't exist, we should download, install and then launch it.
I could develop this module using Java Applet but unfortunately, Google decided to disable NPAPI in September 2015, So the applet will not working on Chrome.
My question is about the Applet alternatives to help me implementing the above scenario ?
The only (semi) viable option as far as I can see, is to offer the Chrome user a link to a JNLP file for a desktop application. Then when/if the JWS desktop application starts, have it report back to the server 'loaded OK' and then 'target app. installed/not installed'.
On your server, have a time out for waiting on the client to report back. If it passes that time, presume the client machine does not support Java at all and the user is checking some web service to try and figure out what app. opens a JNLP!
After searching about the most suitable way to achieve my goal, I think using custom protocols will be a nice solution to access my client applications from the web page.
This solution is used by many companies such as Microsoft (using mailto: to open Outlook application) and Apple (using itms: to open iTunes application).
The following link is a very good link which talk about a custom protocols:
https://support.shotgunsoftware.com/entries/86754-How-to-launch-external-applications-using-custom-protocols-rock-instead-of-http-
Once Google Chrome was the first to announce that they won’t be supporting NPAPI anymore, they were also the first to provide a new architecture in order to rewrite your code to work on their browser. You can take a look on Native Messaging, which “can exchange messages with native applications using an API that is similar to the other message passing APIs”. The problem is that this approach only works on Chrome, is not something that you can adapt to other browsers.
A more useful approach is FireBreath, a browser plugin in a post NPAPI world. Check the words below from one buddy of the project:
“FireBreath 2 will allow you to write a plugin that works in NPAPI, ActiveX, or through Native Messaging; it’s getting close to ready to go into beta. It doesn’t have any kind of real drawing support, but would work for what you describe. The install process is a bit of a pain, but it works. The FireWyrm protocol that the native messaging component uses could be used with any connection that allows passing text data; it should be possible to make it work with js-ctypes on firefox or plausibly WEB-RTC or even CORS AJAX in some way. For now the only thing we needed to solve was Chrome, but we did it in a way that should be pretty portable to other technologies.”

Transitioning from Java to Google App Engine

I am writing a Java program for my workplace, to help catalog pricing with several parameters involved. The current program implements JComboBox, along with other Container objects.
I have realized that our workstation will not run a Java program through Windows due to protective limitations, so I am hoping to transition to Google App Engine, since we can load websites much more freely.
The problem I have run into is that JComboBox doesn't run through Google App Engine. In fact, none of the Containers I was using will work in Google App Engine. The tutorials on Google Developers haven't provided the information I need.
Where can I find information on what objects I can use in Google App Engine to simulate a GUI with pop-up menus and buttons?
(I am using the Google Plugin for Eclipse.)
Maybe this link will help you, it lists all compatible frameworks: http://code.google.com/p/googleappengine/wiki/WillItPlayInJava
For a higly responsive GUI, I suggest you take a look at the GWT: http://www.gwtproject.org/examples.html
In a nutshell: GWT allows you to write web applications with Java. Some/all of the Java is converted into JavaScript for better usability.
If you want to use Google App Engine (GAE) you can either use GWT for a standard GUI or a Java Webframework like Vaadin or JSF.

Categories

Resources