Package org.primefaces.model

Examples of org.primefaces.model.DefaultStreamedContent


        country = null;
    }

    public StreamedContent download() {
        InputStream stream = ((ServletContext) FacesContext.getCurrentInstance().getExternalContext().getContext()).getResourceAsStream("/resources/examples/ROU.xml");
        file = new DefaultStreamedContent(stream, "file/xml", country+".xml");
        return file;
    }
View Full Code Here


        extratoService.getExtratoCliente(dataInicial, dataFinal, cliente);
   
    if(extratoDTO.getItensExtrato().isEmpty()){
      showMsgAlerta();     
    }else{     
      fileExtrado = new DefaultStreamedContent(
          new ByteArrayInputStream(extratoService.gerarExtrato(TipoExtrato.PDF)),
          "application/pdf",
          getNomeArquivo()
        );     
    }
View Full Code Here

        + " "
        + jsfUtil.getLoggedInUser().getLastName()));

    InputStream pdfFile = pdf.execute();

    setPdfFile(new DefaultStreamedContent(pdfFile,
        "application/pdf", "driveTogether.pdf"));
//    DefaultStreamedContent file = new DefaultStreamedContent(pdfFile,
//        "application/pdf", "driveTogether.pdf");
   
//    return getPdfFile();
View Full Code Here

            return null;
       
        FacesContext context = FacesContext.getCurrentInstance();

        if (context.getCurrentPhaseId() == PhaseId.RENDER_RESPONSE) {
            return new DefaultStreamedContent();
        }
        else {
            InputStream is = new ByteArrayInputStream(currentImage.getContent());
            StreamedContent sc = new DefaultStreamedContent(is, "image/jpg", currentImage.getName());
            return sc;
        }
    }   
View Full Code Here

 
  public HelperBean() throws FileNotFoundException {
     FacesContext facesContext = FacesContext.getCurrentInstance();
     ExternalContext externalContext = facesContext.getExternalContext();
     InputStream is = ((ServletContext)externalContext.getContext()).getResourceAsStream("/resources/docs/manual_do_usuario.pdf");
    file = new DefaultStreamedContent(is, "application/pdf", "manual_do_usuario.pdf");
  }
View Full Code Here

        if (file == null) {
            FacesUtil.addError("O arquivo solicitado não pôde ser encontrado");
            return null;
           
        } else {
            return new DefaultStreamedContent(new ByteArrayInputStream(file), null, fileName);
        }
    }
View Full Code Here

    public StreamedContent getStreamedContent() {

        StreamedContent uploadedFile = null;

        if (fileContent != null) {
            uploadedFile = new DefaultStreamedContent(new ByteArrayInputStream(
                    fileContent));
        }

        return uploadedFile;
    }
View Full Code Here

    public StreamedContent getImageFile() throws ServiceBusinessException {

        StreamedContent content = null;

        if (FacesUtil.getFacesContext().getRenderResponse()) {
            content = new DefaultStreamedContent();

        } else {

            String filePath = FacesUtil.getExternalContext().getRequestParameterMap().get("filePath");
            byte[] fileFromServer = serviceUtil.getFileFromServer(filePath);
           
            if (fileFromServer != null) {
                content = new DefaultStreamedContent(new ByteArrayInputStream(fileFromServer));

            } else {
                content = new DefaultStreamedContent();
            }
        }

        return content;
    }
View Full Code Here

  private StreamedContent file;

  public FileDownloadController() {
    try {
      InputStream stream = new ByteArrayInputStream("aaaaa".getBytes());
      file = new DefaultStreamedContent(stream, "text", "ekey.prj");
    } catch (Exception e) {
      System.out.println(e.getMessage());
      e.printStackTrace();
    }
  }
View Full Code Here

    private CroppedImage croppedImageMinMaxSize;

    private StreamedContent graphicText;

    public String cropSimple() throws IOException {
        graphicText = new DefaultStreamedContent(new ByteArrayInputStream(croppedImageSimple.getBytes()));
        return null;
    }
View Full Code Here

TOP

Related Classes of org.primefaces.model.DefaultStreamedContent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.