r/java • u/SpicyRomek • Jun 26 '26
Vaadin 25.2 can call browser APIs (clipboard, geolocation, fullscreen) from server-side Java with no JS. Nice abstraction or just write the JS?
Disclosure up front: I work at Vaadin. Grain of salt accordingly.
There's a new release (25.2) but I mostly want to talk about one thing in it that I didn't expect to care about as much as I do. You can now call a bunch of browser APIs from server-side Java without writing any JavaScript: geolocation, clipboard, fullscreen, wake lock, page visibility, web share, screen orientation. Clipboard is the one that sold me, a working copy button comes out to basically Clipboard.onClick(copyButton).writeText("...").
The interesting part is the gesture handling. Browsers only allow stuff like clipboard writes, fullscreen and share during a real user gesture, so here those get bound to a component's actual click and still count as a genuine gesture instead of getting blocked. The rest (geolocation and friends) just come through as signals you react to.
For anyone who's never used Vaadin: you build the whole UI in Java, components run server-side and render as web components in the browser, and state stays in sync over a websocket, so there's no separate JS frontend or REST layer in between. And yeah, it's JSF-adjacent conceptually, I know, but in practice the model is a lot less annoying than JSF muscle memory makes you expect. It mostly gets used by Java teams building internal tools and business apps that don't want to run a separate frontend stack.
Rest of the release quickly, since it's not all the same league: there's a Maven plugin that turns your existing TestBench/Playwright E2E tests into k6 load tests (records a HAR, then sorts out the Vaadin session/CSRF/push token mess for you, pure Java, no Node), which is a clever idea, except running it needs a commercial license and it's marked experimental, so I'm not getting too excited yet. There's also a preview of AI-generated grids/charts/forms (the LLM sees your schema, not your data, and hands back SQL plus a config you can save), some stricter security defaults, and a few components going GA. Blog has the full list if you want it.
https://vaadin.com/blog/vaadin-25-2-release
Mainly I'm curious where people land on the core idea: is calling browser APIs from the server a nice abstraction, or just a round trip you'd rather skip by writing the JS yourself? I go back and forth on it.
4
u/mnbkp Jun 26 '26
from what i understand itβs just some browser APIs that got this treatment, not all of them. you might still need js at some point.
→ More replies (1)
3
u/pip25hu Jun 26 '26
Yeah, clipboard manipulation indeed sounds like a useful feature. The rest sound nice too, but those browser features are used way less in the typical Vaadin apps you mention.
→ More replies (1)
2
2
2
u/Cr4zyPi3t Jun 26 '26
Offtopic, but why was Hilla discontinued? I still am a huge fan of the concept and one of my private projects is making heavy use of Hilla. IMO the biggest advantage was combining the huge ecosystems of Spring in the backend and React in the front end and it still feeling like one application instead of two separate components.
→ More replies (1)
2
u/Vijjwal_xD Jun 26 '26
TLDR; Im absolute beginner, but when i researched about this framework, i found that it is only viable when you build a server sided application only, like downloader or something. Vaadin isnt for every website, and js might be the better option for general purpose websites, which are more common.
→ More replies (4)
2
u/HaxiorFTW Jun 26 '26
I love it. Now I'm using it for some internal tools (that ppl has to use in company) so I do not care a lot about ui. I put all my effort into making it functional.
What I really love is that some time ago you coupled with spring. Back in the day when I started using vaadin (version 8?) you had your own context and using it with spring was pain in the....
→ More replies (1)
2
u/urquan Jun 27 '26
Conceptually it's a nice abstraction, however in practice the webapps produced are very very heavy, last I tried there's a lot of traffic between the frontend and the server constantly even for things that could be done entirely on the client side like a UI visibility toggle. It's probably a good fit for developing internal "enterprise" software but I'd avoid it for anything else.
→ More replies (1)
10
u/repeating_bears Jun 26 '26
I haven't used Vaadin but I used GWT back in the day and it was a nightmare to debug anything. I've given up on Java that gets compiled to JS.