Works fine here.
Note that you have to clear your browser cache, otherwise you'll still
get the downloaded files without "attachment" in the header.
It would probably be a good idea, to disable caching on your resource:
response.setCacheDuration(Duration.NONE);
Have fun
Sven
On 13.04.2017 03:15, Maxim Solodovnik wrote:
I have modified my quickstart https://github.com/solomax/ajax-download
disposition set to ATTACHMENT
problems so far:
1) only one AjaxDownload on the page works (example:
https://github.com/solomax/ajax-download/commit/ed5c8f898318da9933369c4bc5ecb5f12fb046c1
)
2) setting file name has no effect: for whatever reason file being
downloaded has random UUID name for blob and "download" for iframe, and
"zip" as extension
Quickstart now contains 4 buttons, each generates different "dynamic"
content
Please check
On Thu, Apr 13, 2017 at 4:17 AM, Sven Meier <[email protected]> wrote:
Hi Martin,
actually I meant that FileSystemResource could have a way to *configure*
the content disposition.
There seems to be some duplication emerging between FileSystemResource and
ResourceStreamResource now.
Regards
Sven
On 12.04.2017 22:33, Martin Grigorov wrote:
Hi Sven,
This is another thing that could be added to FileSystemResource besides
the file name.
Why do you think it is safe to assume that ATTACHMENT should be set ?
I see
that org.apache.wicket.request.resource.BaseDataResource#newResou
rceResponse()
does this.
But org.apache.wicket.request.resource.ContextRelativeResource#n
ewResourceResponse()
and org.apache.wicket.request.resource.ResourceStreamResource#ne
wResourceResponse()
set the filename without setting the content disposition.
org.apache.wicket.request.resource.AbstractResource.Resource
Response#contentDisposition
is INLINE by default.
I'll improve the javadoc of AjaxDownload that the content disposition
should be set manually by the application and that INLINE could be used
only with Location.NewWindow
Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov
On Wed, Apr 12, 2017 at 3:09 PM, Sven Meier <[email protected]> wrote:
Hi Maxim,
the resource is responsible to set the right content disposition.
This is another thing that could be added to FileSystemResource besides
the file name.
Have fun
Sven
On 12.04.2017 14:39, Maxim Solodovnik wrote:
I thought Attachment is set by default since it is download ....
Should I retest with it?
Can invalid file name be caused by wrong disposition type?
On Wed, Apr 12, 2017 at 6:46 PM, Sven Meier <[email protected]> wrote:
Hi,
you have to set the content disposition too:
response.setContentDisposition(ContentDisposition.ATTACHMENT);
We could improve the JavaScript so it is more lenient and works without
"attachment" in the header.
Have fun
Sven
On 12.04.2017 12:32, Maxim Solodovnik wrote:
In case I'm setting Location as iFrame, file being downloaded is
"download.zip"
The file name set is also has no effect
On Wed, Apr 12, 2017 at 5:12 PM, Maxim Solodovnik <
[email protected]
wrote:
Weird enough
I have changed the code to produce pain text file (And it is being
created
and has valid text)
But after "mvn clean jetty:run" same zip file is being downloaded
like it was cached somewhere in the browser
On Wed, Apr 12, 2017 at 4:51 PM, Sebastien <[email protected]> wrote:
Then, set the content type to text/html so see if the filename is
correct
in that case.
On Wed, Apr 12, 2017 at 11:44 AM, Maxim Solodovnik <
[email protected]>
wrote:
In case I'm setting file name to "backp.zip.html" the file is being
downloaded as <UUID>.zip
I guess "zip" is being set from content type
File name is just ignored
On Wed, Apr 12, 2017 at 4:38 PM, Sebastien <[email protected]>
wrote:
I know, it's just to test the filename...
On Wed, Apr 12, 2017 at 11:29 AM, Maxim Solodovnik <
[email protected]
wrote:
But I need zip extension, otherwise it will be unusable ....
On Wed, Apr 12, 2017 at 4:27 PM, Sebastien <[email protected]>
wrote:
I did the same problem recently (I still have to answer Sven about
this,
I
will do it soon)
Try out changing your extension to ".html" to see if it's the
same
behavior, maybe it will help you to investigate further. (in my
case,
"csv"
had issue with the filename and "html" was fine)
--
WBR
Maxim aka solomax
--
WBR
Maxim aka solomax
--
WBR
Maxim aka solomax