Package project.util

Source Code of project.util.FileDownloadController

package project.util;

import java.io.ByteArrayInputStream;
import java.io.InputStream;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

import org.primefaces.model.DefaultStreamedContent;
import org.primefaces.model.StreamedContent;

@ManagedBean(name = "fileDownloadController")
@ViewScoped
public class FileDownloadController {

  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();
    }
  }

  public StreamedContent getFile() {
    return file;
  }

  public void setFile(StreamedContent file) {
    this.file = file;
  }
}
TOP

Related Classes of project.util.FileDownloadController

TOP
Copyright © 2018 www.massapi.com. 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.