Package org.fenixedu.academic.domain.documents

Examples of org.fenixedu.academic.domain.documents.GeneratedDocument


    }

    public ActionForward downloadDocument(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request,
            HttpServletResponse response) throws IOException {
        final IDocumentRequest documentRequest = getDocumentRequest(request);
        GeneratedDocument doc = documentRequest.getLastGeneratedDocument();
        if (doc != null) {
            final ServletOutputStream writer = response.getOutputStream();
            try {
                response.setContentLength(doc.getSize().intValue());
                response.setContentType("application/pdf");
                response.addHeader("Content-Disposition", "attachment; filename=" + doc.getFilename());
                writer.write(doc.getContent());
                writer.flush();
            } finally {
                writer.close();
            }
        }
View Full Code Here


        return false;
    }

    public GeneratedDocument getLastGeneratedDocument() {
        DateTime last = null;
        GeneratedDocument lastDoc = null;
        for (GeneratedDocument document : getDocumentSet()) {
            if (last == null || document.getUploadTime().isAfter(last)) {
                last = document.getUploadTime();
                lastDoc = document;
            }
View Full Code Here

TOP

Related Classes of org.fenixedu.academic.domain.documents.GeneratedDocument

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.