Foros de discusión
Resource export and filename
antonio perez, modificado hace 9 años.
Resource export and filename
New Member Mensajes: 15 Fecha de incorporación: 7/02/13 Mensajes recientes
Hi,
I have been looking the example jsf2-export-pdf-portlet but I have not seen how to change the file name.
Can someone help me, please?
I have been looking the example jsf2-export-pdf-portlet but I have not seen how to change the file name.
Can someone help me, please?
Juan Gonzalez, modificado hace 9 años.
RE: Resource export and filename
Liferay Legend Mensajes: 3089 Fecha de incorporación: 28/10/08 Mensajes recientes
Hi antonio,
you can use Resource#getResponseHeaders method to change the file name:
https://github.com/liferay/liferay-faces/blob/3.2.4-ga5/demos/bridge/jsf2-export-pdf-portlet/src/main/java/com/liferay/faces/demos/resource/CustomerExportResource.java#L159-161
you can use Resource#getResponseHeaders method to change the file name:
https://github.com/liferay/liferay-faces/blob/3.2.4-ga5/demos/bridge/jsf2-export-pdf-portlet/src/main/java/com/liferay/faces/demos/resource/CustomerExportResource.java#L159-161
Gaël Paruta, modificado hace 9 años.
RE: Resource export and filename
New Member Mensajes: 13 Fecha de incorporación: 5/05/14 Mensajes recientes
Hi,
@Override
public Map<String, String> getResponseHeaders() {
Map<String, String> map = new HashMap<String, String>();
map.put("Content-Disposition","attachment;filename="+ YOURFILENAME+"."+YOURFILEEXTENSION);
return map;
}
@Override
public Map<String, String> getResponseHeaders() {
Map<String, String> map = new HashMap<String, String>();
map.put("Content-Disposition","attachment;filename="+ YOURFILENAME+"."+YOURFILEEXTENSION);
return map;
}
antonio perez, modificado hace 9 años.
RE: Resource export and filename
New Member Mensajes: 15 Fecha de incorporación: 7/02/13 Mensajes recientes
It's what I needed. thank you very much.