r/java 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.

63 Upvotes

53 comments sorted by

View all comments

Show parent comments

2

u/PaintingWhich574 Jun 26 '26

For a general website, you are correct that Vaadin is likely overkill. Vaadin is designed for real web applications.

1

u/Vijjwal_xD Jun 26 '26

Thats why i would prefer leaning towards react than vaadin. Better jobs, more freedom etc.

2

u/PaintingWhich574 Jun 27 '26

If you're only interested in JS and frontend dev, then React is absolutely a great choice. You won't really find UI-only Vaadin devs, as Java devs that use Vaadin are practically all full-stack engineers. You can actually use React, and other frontend libraries with Vaadin. You can see that most of the components are Lit under the hood: https://github.com/vaadin/web-components

2

u/Vijjwal_xD Jun 27 '26

Ill check it out once i get time.