Rev 200 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 200 | Rev 204 | ||
|---|---|---|---|
| Line 9... | Line 9... | ||
| 9 | import javax.servlet.ServletContext; |
9 | import javax.servlet.ServletContext; |
| 10 | 10 | ||
| 11 | import org.primefaces.event.FileUploadEvent; |
11 | import org.primefaces.event.FileUploadEvent; |
| 12 | import org.primefaces.model.DefaultStreamedContent; |
12 | import org.primefaces.model.DefaultStreamedContent; |
| 13 | import org.primefaces.model.StreamedContent; |
13 | import org.primefaces.model.StreamedContent; |
| 14 | import org.primefaces.model.UploadedFile; |
- | |
| - | 14 | import org.primefaces.model.file.UploadedFile; |
|
| 15 | import org.springframework.context.annotation.Scope; |
15 | import org.springframework.context.annotation.Scope; |
| 16 | 16 | ||
| 17 | import br.com.ec.core.util.TipoExtensao; |
17 | import br.com.ec.core.util.TipoExtensao; |
| 18 | import br.com.ec.domain.dto.ArquivoDTO; |
18 | import br.com.ec.domain.dto.ArquivoDTO; |
| 19 | import br.com.ec.domain.dto.ArquivoFuncionarioDTO; |
19 | import br.com.ec.domain.dto.ArquivoFuncionarioDTO; |
| Line 153... | Line 153... | ||
| 153 | public StreamedContent downloadPastaArquivos(final String nomeArquivo, final String extensao) { |
153 | public StreamedContent downloadPastaArquivos(final String nomeArquivo, final String extensao) { |
| 154 | return new VerificadorLancamentoException().verificarLancamentoException(new CommandRelatorioStreamedContent() { |
154 | return new VerificadorLancamentoException().verificarLancamentoException(new CommandRelatorioStreamedContent() { |
| 155 | @Override |
155 | @Override |
| 156 | public StreamedContent execute() { |
156 | public StreamedContent execute() { |
| 157 | InputStream arquivo = FacesContext.getCurrentInstance().getExternalContext().getResourceAsStream("/arquivos/" + nomeArquivo + "." + extensao); |
157 | InputStream arquivo = FacesContext.getCurrentInstance().getExternalContext().getResourceAsStream("/arquivos/" + nomeArquivo + "." + extensao); |
| 158 | return new DefaultStreamedContent(arquivo, TipoExtensao.parse(extensao).getDescricao(), nomeArquivo + "." + extensao); |
- | |
| - | 158 | return DefaultStreamedContent.builder() |
|
| - | 159 | .contentType(TipoExtensao.parse(extensao).getDescricao()) |
|
| - | 160 | .name(nomeArquivo + "." + extensao) |
|
| - | 161 | .stream(() -> arquivo).build(); |
|
| - | 162 | // return new DefaultStreamedContent(arquivo, TipoExtensao.parse(extensao).getDescricao(), nomeArquivo + "." + extensao);
|
|
| 159 | // return new DefaultStreamedContent(arquivo, TipoExtensao.PDF.getDescricao(), nomeArquivo + "." + extensao);
|
163 | // return new DefaultStreamedContent(arquivo, TipoExtensao.PDF.getDescricao(), nomeArquivo + "." + extensao);
|
| 160 | }
|
164 | }
|
| 161 | }); |
165 | }); |
| 162 | }
|
166 | }
|
| 163 | 167 | ||