Support for offline storage in Javafx 2.x - storage

I have an application that shall support offline storage of user data in case the server is unreachable. In Javafx 1.3 that was achieved via the classes javafx.io.Storage and javafx.io.Resource.
When migrating to Javafx 2.0 these classes have been discontinued. I believe that the guys at Oracle have an equivalent functionality for it in Java.
My question is What is the equivalent of the aforementioned classes in Javafx 2.0 What I want is to specify a resource name to which I can store data without worrying where it is exactly stored on the client file system, the same as browsers cookies.
Thanks for your help
Ahmed

There is no equivalent of javafx.io.Storage and javafx.io.Resource in JavaFX 2.x itself. Because JavaFX 2.x is based on Java, you can use Java services.
The JNLP FileSaveService and FileOpenService may be used. These services should work across JNLP based deployments (browser embedded and webstart apps) - not sure if they work for standalone apps.
If you know that your application will be run as a standalone app or a signed browser embedded or webstart app with higher privileges, then you can get the user directory via the user.home system property and write your app data to an an appropriate file location under that, probably using the Files api as in this Files tutorial. For example, use the Files api to create a {$user.dir}/.myapp/appdata.dat file to read and write.
JavaFX embeds an html5 web engine. The WebEngine in JavaFX 8 implements the offline storage portion of the html5 specification, the WebEngine in JavaFX 2.2 does not.

Related

How to create content in apache sling using java program

I am new to apache sling i want to create content(node) using java program and that to be stored in jackrabbit
Every HTTP request targeting Sling (localhost:8080/path/to/my/resource) providing basic authentication will do just fine. In that sense Sling is completely client agnostic and you are free to choose language and library (i.e. Apache Commons) of your choice.

How to load javascript globally on a web-based Rhomobile application

We are looking at transferring our web-based app from Naurtech CETerm to Rhomobile. We can change javascript functions/meta tags to use the methods of Rhomobile instead of CETerm, but due to the poor hardware performance of our devices the slow down caused by the overhead of loading jQuery and other files is significant. (Prior to this we had no requirement for jQuery, although it would have been nice to have it). We also now need the rhoapi javascript which is significant.
Is there a way to include these "framework" javascript files in the Rhomobile container app and have them available to all pages loaded without them needing to be re-parsed on each page load?
It is currently a web based app loaded using something like the following in our rhoconfig.txt file as opposed to a local file:
start_path = 'http://xxxxxx.co.uk/login.php'
My current understanding is that this means the app/layout.erb file cannot be used to solve this problem?
Thanks
More than RhoMobile Suite (and it's RhoElements enterprise device framework) you can take a look at Zebra Technologies' Enterprise Browser that is intended to be used as a stand-alone industrial browser, targeting Windows Mobile/Windows CE and Android devices manufactured by Motorola Solutions (now Zebra Technologies).
On "not too old" Windows CE/ Windows Mobile devices Zebra's Enterprise Browser uses a webkit derived HTML5 capable renderer engine so, to answer your question, you can use HTML5 application cache to download the JavaScript libraries only if there's an update, in this way you can remove any network delay.
I've seen some project using giant JavaScript files (well above 1MB compressed) on old WinCE 6.0 devices, the startup time is clearly the biggest problem, with the risk to look at a white page for 5-7s. This can be alleviated with an async loader and a splash screen. It's not going to make your page faster, but the user will know what is going on.
You can find more information about Enterprise Browser on Zebra Technologies developer website, the Launchpad, inside Enterprise Browser area.
If you build your custom RhoMobile web-app container with the idea to use in server pages, local resources, you can hit some issues around cross-site scripting prevention policies.

Combine JQM, MVC and PhoneGap together

I have a site which uses microsoft mvc 3 on the server side, jQuery Mobile on the client side and I want to combine it with PhoneGap and produce executes for Android and iOS.
Is it possible?
How?
Thanks
Yes, it is possible.
If you must use Phonegap, there are a couple of things to do:
First, you must create a project corresponding to each platform , following these instructions. Once you do that, you basically copy all the client side code (js, html, css) to the www folder of your project. This is one of the reasons, the app could load faster, since it's reading its resources from the local filesystem, and not receiving them from an http connection each time.
Second, you must find a way to provide your server side data to your app. If you are already using REST services or RPC methods to populate your website, then that's done, but if not, you must start by building them, and then calling them from your client (through ajax calls from jQUery most likely), and then rendering them through javascript (you can use the multiple templating libraries out there or just plain javascript, I recommend the latter only if the UI updates are minimal).
As you can see, the second part requires quite a little bit more work. Especially if you haven't built web services before.
The other option ,which does not require phonega/cordova is to use an embedded webview. Then you wouldn't have to do anything. It would work similarly to a browser (Loading the remote URL of your site), with the added advantage of being inside and android/ios app, and you could add other views or communicate with the embedded webview using native code. If you are planning to load html files from the filesystem and not from your server, you would have to do the same thing you have to do with phonegap.
It happened to me, if you have a web app depending on server code I would go with a WebView based app, and not a Cordova app.
It's really simple to create those webviews apps for Android or IPhone.
Here you have an example for building a webview based app on android
Here you have an example for building a webview based app on IOS
Hope it helps.
If you want to reuse your site you'll need a webview that browses it.
Phonegap wouldn't be needed if you use this approach, but the application will not be as responsive as a native app, and the IPhone moderators may reject your app for that reason (it happened to me).
Another approach would be that you recreate your site as a pure Javascript application and only communicate with your servers to execute some REST Services. In this case Apache Cordova makes sense.

How to call Java EE SOAP or REST services from mobile platform. etc Dxtreme, Jquery Mobile, Icenium

I want to develop mobile apps based on HTML, JS. It must work on any device etc iphone, ipad, android and windows phone...
I must use JAVA EE on server side. First I choosed Dxtreme. after I learned dxtreme, it is possible REST Service using ASP.NET Web API. But it is inpossible on Java EE. following error :
But call along #POST, #PUT and #DELETE methods throws error
"XMLHttpRequest cannot load http://www.restserver/Service/item. Origin
http://www.localhost:51140 is not allowed by Access-Control-Allow-Origin".
I believe there must be something that people must be using SOAP or REST Service on Mobile.
Which mobile framework is it possible ?
Please help me.
Thanks.
have You read About Phonegap?U can use phonegap to build application that can work around different Mobile platform.Its uses HTML5,CSS3,Javascript.Hope this helps you......
Generally, people access web services using RESTful interfaces on the server end. You can create that with ASP.NET Web API and many other server side frameworks of course. Your error, I'm guessing, but not sure, is from your client application. If I'm correct, you are probably running some simulator or the app within a browser client, and not one of the mobile framework simulators, and are running into the problem where the browser restricts your access to services on systems other than the site your started with. I.e. if you got to myboringwebpage.com and try to look up something on api.twitter.com within the app, the browser will stop you unless you add certain things to your web server/page telling the browser that that is OK. Look up "CORS". With Icenium, if you use the browser development environment "Mist" you will get those issues. If you use the Windows environment "Graphite" there is no such restriction. If you use the Intel HTML5 XDK at http://html5m.com/, it runs some process to get around those issues, while running a simulator in a browser. If you end up building PhoneGap apps, which you can using Icenium, appery.io, Intel HTML5 XDK, PhoneGap Build and others, the built app, installed on the phone, will not be restricted as an in-browser "app" would. However, I had problems with the Intel framework's XHR code handling all the different methods. Sorry this probably doesn't cover everything you need - you'll have to live and learn a lot of this.

Dwscript web server

I want to use dwscript for web programming ( generating dynamic content). I was wondering if there is any module for apache web server? Or how can I run my own web server based on dwscript?
I'm not (yet?) familiar with DWScript, but I've created an Apache module that runs a Delphi-compiled module that serves a web-site over an abstract interface, so it can plug into IIS or InternetExplorer also. There are also versions that auto-recompile when it detects changes to the source-code, so you can develop and test by hitting refresh in the browser window:
http://xxm.sourceforge.net/

Resources