Bakery App and FileDownloader

Hi,

Sorry for posting here but this really is related to the FileDowloader in bakeri Demo, when I create an instance of the class in a window, my simple pdf is downloading more and more, that is, it is as if the cache or something by the style would have to see, not just once per window that is the right thing to do.

The first time I realized that it is not downloaded for lack of this line headers.frameOption().sameOrigin();

SecurityConfig.java

https://github.com/igor-baiborodine/vaadin-demo-bakery-app/blob/master/src/main/java/com/kiroule/vaadin/demo/app/security/SecurityConfig.java

The class where I create my StreamSource and FileDownloader, has the annotation @PrototypeScope and @SpringComponent and that class extends from a VerticalLayaout

I did not quite get what you meant by downloading more and more. Can you try to explain it again?

Is the download presented as an url when you hover? If yes, it mihght be that Spring Security intercepts your download and the login page is downloaded instead of the file. If so, you need to add the url to the file to your securityConfig to say that it is okay to download from there. You can see that the same is done to /VAADIN/ folder by having row 51 in your code - reg.antMatchers(“/VAADIN/**”).permitAll();.

This is just a guess, if you have more details, it might help.

Great that you got it working!

Hello, thank you, Jens Jansson, you had already answered me before and I could not answer you because I was somewhat busy. I’m sorry, but I could solve it, with
removeAllComponents()
I worked in this specific case.