Skip to content

docs: pass AttachmentType.INLINE to serve a download inline - #6758

Merged
peholmst merged 3 commits into
mainfrom
doc-bot/vaadin-flow/27088-1f12bae9e99e9108
Dec 2, 2026
Merged

peholmst merged 3 commits into
mainfrom
doc-bot/vaadin-flow/27088-1f12bae9e99e9108

Conversation

@vaadin-bot

@vaadin-bot vaadin-bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Documentation for vaadin/flow#27088 by @totally-not-ai[bot].

Note

The source pull request is merged, so this documentation describes the final
shape of the change. Please review it and mark it ready for review.

Change categories: BEHAVIOR_CHANGE, BREAKING_CHANGE

File Change
articles/flow/advanced/downloads.adoc Rewrote the file-system download example: Anchor's AttachmentType now decides on its own whether a built-in handler is served inline or as an attachment, so the example no longer needs a separate .inline() call on the handler. Added a warning about serving untrusted content inline, and a 25.4 since badge on the AttachmentType.INLINE sentence. In the Custom Download Handlers section, replaced the example that used the deprecated handler inline() and a nonexistent fromFile() with a link to the file-system example, and named forFile(File, String) for the file-name parameter.

Auto-generated by the Documentation Bot — review before merging.

Generated by Documentation Bot for #27088 · agent · 97.7 AIC · ⊞ 11.7K · ◷

  • expires on Dec 23, 2026, 8:28 PM UTC

Anchor's AttachmentType now decides on its own whether a built-in
download handler is served inline or as an attachment, so the handler
no longer needs its own inline() call for that. Updates the file
system download example on the Downloads page accordingly, and adds a
warning about serving untrusted content inline.

Documents vaadin/flow#27088 (`12974d1c4b622b8dda573e854e499fb84c5abd67`).
@github-actions

Copy link
Copy Markdown
Contributor

Preview Deployment

This PR has been deployed for preview.

URL: https://docs-preview-pr-6758.fly.dev

Changed pages

Added content is highlighted in green; removed content is marked in red on each page.

Built from 75ea15a

@peholmst
peholmst marked this pull request as ready for review December 2, 2026 07:44

@vaadin-review-bot vaadin-review-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the changes — left 2 comments.

Finding
⚠️ The same page still teaches the deprecated inline() call that this change removes
📐 The 25.4 behavior change has no since badge, unlike the neighbouring statements

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Around line 398 — could not attach to the exact diff line.

⚠️ The same page still teaches the deprecated inline() call that this change removes

Line 164 now says that AttachmentType.INLINE on the Anchor decides this, but 230 lines further down the page still says the opposite:

When [classname]DownloadHandler is used with Anchor component, the data is downloaded as a file.
This can be changed to render the data in the browser by using [methodname]inline() method:

AbstractDownloadHandler.inline() is @Deprecated(since = "25.4", forRemoval = true) (flow-server/.../streams/AbstractDownloadHandler.java:178), and its Javadoc names AttachmentType.INLINE as the replacement for an Anchor. A reader who reaches that section first copies an API that disappears in Vaadin 26. Updating it the same way as the example above keeps the page consistent. (Its DownloadHandler.fromFile also doesn't exist — the method is forFile — which is worth fixing while rewriting those lines.)

downloads.adoc:398 · accuracy

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. The section further down no longer shows the deprecated handler inline() with fromFile(). It now links to the AttachmentType.INLINE example in Download A File From File System, so the page has one inline example, with the badge and the untrusted-content warning. The file-name sentence now names DownloadHandler.forFile(File, String).

Comment thread articles/flow/advanced/downloads.adoc Outdated

The [classname]`Anchor` component sets the `download` attribute by default and download handlers extending [classname]`AbstractDownloadHandler` also set the `Content-Disposition` to `attachment`.
If the content should be inlined to the page, this have to be set explicitly by calling the [methodname]`inline()` method on the `DownloadHandler` instance and using `AttachmentType.INLINE`:
The [classname]`Anchor` component sets the `download` attribute by default, and a handler that only gives a file name, as the built-in handlers do, is served as an attachment to match. Passing `AttachmentType.INLINE` to the [classname]`Anchor` constructor removes the attribute and serves that same content inline instead:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 The 25.4 behavior change has no since badge, unlike the neighbouring statements

That an AttachmentType on the Anchor decides the Content-Disposition is new in 25.4: it works through DownloadDisposition, which is @since 25.4 (flow-server/.../streams/DownloadDisposition.java:33). In 25.3 the handler's own inline() decided it, as the removed text said.

CONVENTIONS.md:82 says to mark new features with a since badge, and the two paragraphs above and the section below already carry [since:com.vaadin:vaadin@V25.4]. Wrapping the second sentence, the one about AttachmentType.INLINE, in a badge would match them.

downloads.adoc:164 · conventions

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added [since:com.vaadin:vaadin@V25.4] around the AttachmentType.INLINE sentence. The Flow change was cherry-picked to 25.4.

….INLINE

The Anchor section further down still used the deprecated handler
inline() and a nonexistent fromFile() method. Use AttachmentType.INLINE
and forFile() there too, and mark the AttachmentType behavior with a
25.4 since badge like the neighboring statements.
@peholmst
peholmst merged commit 2cfb002 into main Dec 2, 2026
10 of 11 checks passed
@peholmst
peholmst deleted the doc-bot/vaadin-flow/27088-1f12bae9e99e9108 branch December 2, 2026 08:47
peholmst pushed a commit that referenced this pull request Dec 2, 2026
## Summary

Two pages still chained the deprecated
`AbstractDownloadHandler.inline()` (deprecated for removal in 25.4).
This removes those calls.

## What changed

- Map, "Styling Clusters": the custom cluster icon example no longer
calls `.inline()`. Map serves icon images inline by itself in 25.4.
- Building Apps, "Handle Downloads": the "Inline rendering" bullet no
longer points to `inline()`. It says that components that show content,
such as `Image`, already serve it inline, and that an `Anchor` takes
`AttachmentType.INLINE` (with a 25.4 badge).

The same deprecated call on the Downloads reference page is handled in
#6758.

## Test summary

- Checked against Flow and Flow Components 25.4: the `inline()`
deprecation note, and the Map serializer registering icon images with
`DownloadDisposition.INLINE`.

Working on behalf of Petter

---------

Co-authored-by: totally-not-ai[bot] <290682512+totally-not-ai[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants