How to isolate servlet side code from gwt side

Vaadin has done a spectacular job in designing a framework that reduces a lot of programming and architecturing overhead.

It is successful in merging the gwt client and servlet processes.

So successful, so much so that now I have trouble understanding how to decouple gwt client from the server.

There are routines that I wish to write solely for the server side - but I am unable to because vaadin requires every class that I write be serializable. I do not know how to create a vaadin dependent class that would not be included in gwt compilation or how to tell vaadin to free my servlet-only code from gwt compilation.

I don’t want to write server-side bean that is independent of vaadin. I want to be allowed an escape thro @annotation or method or interface that lets me write server-side bean that is tied into the vaadin framework and session control.

In pure gwt, we have the client, public and server folders - very straight-forward decoupling. Decoupling code-wise but not httpsession-wise. I wish to be allowed servlet only code that still have MUTUAL interaction with the vaadin session framework.

My troubles start after I define a class extending vaadin Application. How do I write a server side bean that would access and be accessible by this vaadin Application. I want my server-side bean to interact with the vaadin Applicationservlet and depend on the Applicationservlet to communicate with the vaadin gwt client, without having me to design a whole new json communication architecture.

Please do not recommend portlet unless there is a way to make liferay work with gae.

Please advise me if there is a way to do it. Point me to the page in the vaadin pdf or references to the the vaadin javadoc.

No, they don’t have to be serializable, unless you want to run them in some cloud environment, such as GAE, which requires that everything is serializable. That serialization, which is actually server-to-server-serialization, has
nothing
to do with the GWT client-server communications. Also Eclipse likes to be able to serialize the application state to do hot code replacement.

I’m not sure if I understood your problem correctly; I hope you have not misunderstood the serialization in Vaadin.

So, there are two
totally different
cases of serialization:

  • When you develop entirely new custom components using GWT, which is not a typical use-case for Vaadin, you need to implement serialization of the component state between the server and the client. This is not done using the Serializable interface.
  • When you fulfill the server-side Serializable interface to allow running the application in cloud environments that require server-to-server serialization

Thanks for clarifying my misunderstanding about the serialization.

However, would I be correct to say, that

  • all codes written inside a window or component in an Application runs on the client or have parts running on the client
  • all codes outside a component but in an Application runs on the server.

All your application code is always running on the server side. Client widgets are working as a presentation layer (say, like a terminal) displaying the application and UI state in a client’s browser.

So, unless you’re creating your own client-side widget with some client-side gwt code, your application code is always running on a server.