reset password
Author Message
nahmed5
Posts: 57
Posted 21:32 Feb 16, 2015 |

Hi Prof! Why do we need submissionId in the DownloadController.java? Is it used when a student finshes an exam and submits it online? Do we need it for the midterm? Thanks!

 

@RequestMapping(value = "/download", params = "submissionId")
    public String downloadSubmissionFiles( @RequestParam Long submissionId,
        HttpServletResponse response, ModelMap models ) throws IOException
    {
        Submission submission = submissionDao.getSubmission( submissionId );
        String name = submission.getAssignment().getAlias().replace( ' ', '_' );

        response.setContentType( "application/zip" );
        response.setHeader( "Content-Disposition", "attachment; filename="
            + name + ".zip" );

        ZipOutputStream zip = new ZipOutputStream( response.getOutputStream() );
        addToZip( zip, name, submission.getFiles() );
        zip.close();
        return null;
    }

 

cysun
Posts: 2935
Posted 23:14 Feb 16, 2015 |

That controller is used to download all the files in a submission as a zip file.