Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void descargarArchivo(SedeDatosArchivo pArchivo) {
- Archivador archivador;
- byte[] datos;
- FacesContext fc;
- ExternalContext ec;
- try {
- archivador = new Archivador();
- datos = archivador.obtenerArchivoEncuestaSede(pArchivo.getNombre(), pArchivo.getIdSedeExamen());
- fc = FacesContext.getCurrentInstance();
- ec = fc.getExternalContext();
- ec.responseReset();
- ec.setResponseContentLength(datos.length);
- ec.setResponseHeader("Content-Disposition", "attachment; filename=\"" + pArchivo.getNombre() + "\"");
- OutputStream output = ec.getResponseOutputStream();
- output.write(datos);
- fc.responseComplete();
- } catch (Exception e) {
- this.mostrarMensaje(Constantes.SERVERIDAD.ERROR, MensajesInternos.ERROR_AL_ELIMINAR_INFORMACION);
- }
Add Comment
Please, Sign In to add comment