Help on cookie and data exchange between two apps

I am new to vaadin. Here 2 questions coming up, hope to get answers…

  1. Any easy way to access cookie within vaadin framework like - setCookie / getCookie via http request/response class as usual Serlvet code, but now Serlvet is underlying controlled by vaadin framework, how should we do this - need to use ApplicationContext? Can anybody share this?

  2. How to exchange data between two apps - this is like session info, for example app-2 (a different URL) need to get the result from app-1, but I am not sure how to do that, by walking through AppContext to locate an application instance and get the needed data? I guess static variable defined in the Java code should be in global JVM scope but not per session. Who can show a help on this?

Appreciate to see your share… Best regards…


A couple of ways of accessing browser cookies:

An easy to use add-on for this:

and directly manipulating request/response in application class:

For exchanging data you could use request parameters, HTTP session (if in same server/cluster), database. Also as you described the static works across all users and applications in a single JVM. Which is actually the best way depends on your amount of data, deployment and security requirements.

Assuming you already have a database in your application, I would probably go for that.

Thanks much, Sami. It works by using the servletrequestlistener to handle HTTP session related data.