Foren

ServletResponseUtil.sendFile filename bug

Eric Soucy, geändert vor 8 Jahren.

ServletResponseUtil.sendFile filename bug

Junior Member Beiträge: 65 Beitrittsdatum: 21.01.14 Neueste Beiträge
Hello,
in a jsf portlet (liferay faces 3.2.4-ga5) we want the user to download a file through a link.

we use the api : ServletResponseUtil.sendFile

with 6.2 EE sp 12 this works fine but with sp 14(+portal-85) the filename ends up on disk to be the name of the current liferay page. (in which the portlet is deployed) instead of the filename provided in the ServletResponseUtil.sendFile api.
the content of the file is ok, it is just the filename that is wrong

Any ideas?

Thanks
thumbnail
Neil Griffin, geändert vor 8 Jahren.

RE: ServletResponseUtil.sendFile filename bug

Liferay Legend Beiträge: 2655 Beitrittsdatum: 27.07.05 Neueste Beiträge
Hi Eric,

I'm surprised that calling ServletResponseUtil.sendFile worked in earlier versions of your JSF portlet. The supported mechanism we have for the bridge is to use a JSF 2 ResourceHandler similar to the one we have in the jsf2-export-pdf-portlet.war demo.

Are you able to refactor your code to use a ResourceHandler instead?

Thank you,

Neil
Eric Soucy, geändert vor 8 Jahren.

RE: ServletResponseUtil.sendFile filename bug

Junior Member Beiträge: 65 Beitrittsdatum: 21.01.14 Neueste Beiträge
Hi Neal,
we tried to refactor using ResourceHandler.
We had a look at your example jsf2-export-pdf-portlet.war
But it seems that the filename is still the name of the current page.

Even in your demo we see the same behavior.

Do you have any ideas?

Thanks

Eric
Eric Soucy, geändert vor 8 Jahren.

RE: ServletResponseUtil.sendFile filename bug

Junior Member Beiträge: 65 Beitrittsdatum: 21.01.14 Neueste Beiträge
Ha !
I ve answered my own question
we need to have a method
getResponseHeaders where we put "Content-Disposition", "attachment; filename=xxx;"

Thanks anyway!
thumbnail
Neil Griffin, geändert vor 8 Jahren.

RE: ServletResponseUtil.sendFile filename bug

Liferay Legend Beiträge: 2655 Beitrittsdatum: 27.07.05 Neueste Beiträge
Hi Eric,

Thanks for reporting back. I just created FACES-2601 in order to improve our jsf2-export-pdf-portlet demo.

Kind Regards,

Neil