-
1. Re: Build offline application with Errai
csa Mar 24, 2014 7:26 PM (in response to malpi)1 of 1 people found this helpfulHi Malte,
Can you explain what you mean by "how I can compile an offline to use version of the Application"? GWT's output is perfectly cacheable JavaScript which browser's can display even when offline (give your webserver is configured correctly and the page was visited before). See http://www.gwtproject.org/doc/latest/DevGuideCompilingAndDebugging.html#perfect_caching.
Errai provides a number of facilities to simplify building application that should work when offline:
- Errai JPA to persist entities into the browser's local storage
- Errai DataSync to synchronize entities in local storage with the server
- ShadowServices that will be used when a Bus/RPC endpoint is not reachable
- Bus Lifecycle listeners to detect when the bus goes offline
Cheers,
Christian
-
2. Re: Build offline application with Errai
malpi Apr 9, 2014 3:21 PM (in response to csa)Hi Christian,
sorry that I answer that late, but I had much to do in the past. I've read a bit more about the HTML5-Caching concept and it's a bit more clear for me. Maybe I should have done this before asking here.
The usecases I want to test are the following:
- User accesses the Application while being online (Therefore it should be cached)
- Usecase 1:
- Shutdown the server => Connection will be lost
- Application should still be usable due to the caching
- Server is coming back to life => Application should therefore reconnect
- Usecase 2:
- The user closes the application
- In the meantime the server will be shutdown
- User tries to access the App again, the files should be in the cache
- Server is coming back to life => Application should therefore reconnect
What we did so far, is implementing the Bus Lifecycle listener, which is recognizing perfectly when the ApplicationServer is going offline and online.
As far as I read, I have to create a GWT Linker, to create the HTML5-Manifest and to state which files need to be cached? (https://code.google.com/p/mgwt/wiki/HTML5Manifest) This is what I wanted to ask for in my initial question. Do I have to implement this linker on my own, or is there something prepared in the Errai Framework?
Hope it's more clear what I mean.
Cheers,
Malte
-
3. Re: Build offline application with Errai
csa Apr 9, 2014 5:09 PM (in response to malpi)Hi Malte,
Yes, good point. If you plan to use HTML's offline capabilities you will have to serve a manifest file that only lists the JS sources (permutations) that the corresponding client needs.
We don't have a built-in linker and servlet for that but Daniel Kurka's solution looks great and you should be able to use it. This is a similar solution that also looks reusable: http://code.google.com/p/gwt2go/source/browse/#svn%2Ftrunk%2Fgwt2go%2Fsrc%2Fcom%2Fgwt2go%2Fdev%2Flinker
Cheers,
Christian
-
4. Re: Build offline application with Errai
malpi Apr 10, 2014 1:26 AM (in response to csa)Hi Christian,
Thanks for pointing this out.
Cheers,
Malte
-
5. Re: Build offline application with Errai
malpi Apr 11, 2014 1:20 AM (in response to csa)Hi there,
I've spent yesterday evening to make this running. In General the mgwt Framework is no help at all, since there will be only compiled Manifests for IE 7 - 9, old Opera versions and Old Safari versions.
Whereas the gwt2go example is really helpfull! But you have to consider that in any case you have to annotate your Linkerclass with "@Shardable". Furthermore you have to put your Linker module into the Serverside, what makes sense, but otherwise you will have some dependency conflicts. In the documentation it's stated that it doesn't matter.
Cheers,
Malte
-
6. Re: Build offline application with Errai
csa Apr 11, 2014 11:28 AM (in response to malpi)Thanks for the update, Malte! This will be helpful to others.
If you feel this approach can be improved or have an idea what Errai could do to simplify this, feel free to create a JIRA for us. Contributions are always welcome!
Cheers,
Christian
-
7. Re: Build offline application with Errai
malpi May 4, 2014 7:02 AM (in response to csa)Hi Christian,
I think it could be helpful to provide a default Linker by the Errai Framework. Because it's a default implementation which can be reused everywhere. And without the generated manifest, the offline capabilities of Errai are somehow useless.
On the other hand at least from my point of view this functionality should be provided by GWT. Therefore it's up to your team to decide that. By time I will conclude my example in a Blogpost and let you know.
Best Regards,
Malte
-
8. Re: Build offline application with Errai
csa May 5, 2014 5:06 PM (in response to malpi)Hi Malte,
I agree having such a linker in Errai (or GWT for that matter) would be really useful. Looking forward to your blogpost!
If you want to contribute your linker to Errai you are more than welcome to send us a pull request and/or create a JIRA for us.
Thanks,
Christian