Are portlets based on servlet?

Hello everyone.

I developed Vaadin portlet for LifeRay portal and now I am concerned about one thing - because GWT is servlet-based framework (and Vaadin is based on GWT) - is Vaadin portlet using servlets or not? I am confused right now, because I thought that GWT is used only for client-side but when I create Vaadin project as portlet (in Eclipse IDE), I can see in web.xml servlet definition with com.vaadin.terminal.gwt.server.ApplicationServlet. But when I create new LifeRay portlet (with Vaadin framework), web.xml is clean without servlet definition.

TL;DR version: Are Vaadin portlets using servlets?

Thanks in advance for any comment

GWT generates javascript for the client.

A portlet running on a server interacts with the javascript running in the browser; this is the same idea as a servlet interacting with javascript in the browser.

So yes, Vaadin portlets interact with GWT-generated code running in the browser, and you can develop portlets with Vaadin that uses the same GWT as servlets.
The code on the server side will be slightly different because portlets are slightly different from servlets (they need to interact nicely with each other on a single screen).

Ehm… so, is for the question: Are Vaadin portlets using for communication with GWT client-side servlets? - answer “YES”?

I know, that portlets are different from servlets but that’s why I am asking this question. I am not sure whether server-side of portlet is using servlet or not (whether normal vaadin aplication based on servlet is just encapsulated in portlet or its completely running in portlet container). :frowning:

“client side servlets” do not exist. GWT can talk to any kind of “webservice” (not necessary a SOAP- or REST-service, just some kind of webbased comm-interface to talk to) and is not restricted to servlets - it is not even restricted to a java-based server side. You could as well programm a PHP-based GWT-“webservice” and use that.

Portlets are a java-standard, completely independent but inspired by servlets. So if you are using Vaadin’s ApplicationPortlet instead of ApplicationServlet, the server-side of your application is natively run by the Portlet-container and there are no servlets or other ugly hacks involved.


Thank you
for answer!!
…and about “…client-side servlet” - I used wrong word order, it’s should be “Vaadin use servlet for communication with GWT client-side” or something like that :smug: (English is not my native language)

The extra servlet mapping in web.xml is generated for ease of testing as servlets, and is not needed when running the application as a portlet.

A portlet 1.0 project (not used much nowadays) is actually based on a servlet, and the portlet on the server just tells the browser to communicate with a separately running servlet - you need to configure both (an oversimplification but gives the idea).

In a portlet 2.0 application (recommended and default), there is no user visible servlet and the portlet is the only entity the client can communicate with.

To be accurate, several portlet containers including Liferay are running on top of servlet containers so actually there is a servlet, but it is a portal internal “hidden” servlet that your application never interacts with directly - you don’t need to know or configure anything about it.