Skip to content

Commit

Permalink
a bit mor documentation (#789)
Browse files Browse the repository at this point in the history
  • Loading branch information
rbri committed May 18, 2024
1 parent 31e8574 commit 0e62935
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ default boolean handleAttachment(final WebResponse response, final String attach
default boolean isAttachment(final WebResponse response) {
final String disp = response.getResponseHeaderValue(HttpHeader.CONTENT_DISPOSITION);
if (disp == null) {
// if there is no content disposition header and content type application/octet-stream
// if there is no content disposition header and content type 'application/octet-stream'
// is handled like an attachment by the browsers
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types#applicationoctet-stream
// They treat it as if the Content-Disposition header was set to attachment, and propose a "Save As" dialog.
Expand Down
3 changes: 2 additions & 1 deletion src/site/xdoc/filedownload-howto.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ try (final WebClient webClient = new WebClient(BrowserVersion.FIREFOX)) {
The AttachmentHandler based download support works in addition to the default UnexpectedPage based support. This means, if your AttachmentHandler
does not handle the content, the webClient will fall back to the default solution and place an UnexpectedPage inside the window.
You can overwrite the method isAttachment() in your AttachmentHandler to only handle dedicated responses - the default implementation
only detects responses having a content-disposition header of type 'attachment'.
only detects responses having a content-disposition header of type 'attachment' or having no content-disposition header at all and
and content-type header of 'application/octet-stream'.
</p>
<p>
The method <source><![CDATA[boolean handleAttachment(final WebResponse response, final String attachmentFilename)]]></source>
Expand Down

0 comments on commit 0e62935

Please sign in to comment.