Touchkit locale storage not working

I try to use the data storage on mobile.

    public static String getStoredLogin() {		
	StorageMap storageMap = new StorageMap(
			Storage.getLocalStorageIfSupported());
	return storageMap.get(LOGIN_KEY);
}

And i have this error:

Caused by: java.lang.UnsupportedOperationException: ERROR: GWT.create() is only usable in client code! It cannot be called, for example, from server code. If you are running a unit test, check that your test case extends GWTTestCase and that GWT.create() is not called from within an initializer or constructor.
at com.google.gwt.core.client.GWT.create(GWT.java:92)
at com.google.gwt.storage.client.Storage.(Storage.java:107)
… 36 more

Have you any idea? Thanks…

Hi,

I assume you are trying to access LocalStorage from server side. Don’t know what you are trying to achieve, but you could extend the client side so that you could fetch the data to server with async api. In Vornitologist (our demo app) LocalStorage stored data that is collected during offline mode is sent to server in Vaadins standard communication channel. Check that example for a reference.

cheers,
matti

Thank you for your response,
I watched the example but I am in another contetxe: I seek simply to store a username / password at the client, without being offline.
How to ensure that this operation is going on the client side and not server side? Thank you again!

Hi, I am having the same issue here. Did you find a solution to your problem (how to use GWT Storage) ? Thanks in advance!

Hi,

To use HTML5 storage on client side you need to be doing client side code. With latest versions of GWT you can use Storage class.

If you wist to persist/retrieve data to HTML5 storage from server side you currently need to do your own extensions to Vaadin client side. If you want to live on the edge you could try svn build of V7 compatible TouchKit. I
just committed
there a prototype of generic server side proxy to HTML5 local storage. If you need something similar for the stable version, use the powers of
your pro account
to boost backporting of such a feature.

cheers,
matti