Vista Combinata Vista Piatta Vista ad Albero
Discussioni [ Precedente | Successivo ]
toggle
Simeon Kredatus
file download using liferay+jsf portlet bridge
8 settembre 2012 2.07
Risposta

Simeon Kredatus

Punteggio: New Member

Messaggi: 1

Data di Iscrizione: 8 settembre 2012

Messaggi recenti

Hi,

I need to let user download some attachment(file) from the server using liferay portlet with jsf bridge. I think I have few possibilities how to solve this problem:
1) use direct link to some public server directory
2) use some kind of download servlet, where the user would be redirected in case of download action.
3) I hope there is also third solution - do the same work the helper download servlet is doing from the managed bean in portlet - just write a stream into HttpServletResponse.

The first and the second solutions are working fine - but I think it is not the best way how to solve this. I'd like to make it work the way I described in the third option. I've done many attempts but I couldnt make the third solution work. So I'm asking you - is it possible to do it this way at all? If yes, please could you provide some basic proof of concept or little more information about how to do it. I tried obtaining HttpServletResponse and writing to it but nothing happenned, I also tried many other solutions of this i found on google but also it wasn't working...

Thanks for advices.
Neil Griffin
RE: file download using liferay+jsf portlet bridge
19 settembre 2012 10.39
Risposta

Neil Griffin

LIFERAY STAFF

Punteggio: Liferay Legend

Messaggi: 1418

Data di Iscrizione: 26 luglio 2005

Messaggi recenti

The JSF2 way of doing this would be to create a custom ResourceHandler. The jsf2-export-pdf-portlet demo is an example of how to do this.
Maximilian Hillebrand
RE: file download using liferay+jsf portlet bridge
9 febbraio 2013 6.57
Risposta

Maximilian Hillebrand

Punteggio: New Member

Messaggi: 4

Data di Iscrizione: 17 dicembre 2012

Messaggi recenti

My solution for solving download functionality in jsf-portlet:
  • extend GenericFacesPortlet and override serveResource method with your download functionality
  • in your jsf-view use portlet:resourceURL with or without params
  • adjust portlet.xml <portlet-class>your.extended.GenericFacesPortlet</portlet-class>