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#newResourceResponse() does this. But org.apache.wicket.request.resource.ContextRelativeResource#newResourceResponse() and org.apache.wicket.request.resource.ResourceStreamResource#newResourceResponse() set the filename without setting the content disposition. org.apache.wicket.request.resource.AbstractResource.ResourceResponse#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 >>>>> >>>>> >>>>> >>>> >> >
