Example usage for javax.servlet.http HttpServletResponse encodeRedirectUrl

List of usage examples for javax.servlet.http HttpServletResponse encodeRedirectUrl

Introduction

In this page you can find the example usage for javax.servlet.http HttpServletResponse encodeRedirectUrl.

Prototype

@Deprecated
public String encodeRedirectUrl(String url);

Source Link

Usage

From source file:org.muse.mneme.tool.GradeAssessmentView.java

/**
 * {@inheritDoc}/*  www.  ja  va 2s . c o  m*/
 */
public void get(HttpServletRequest req, HttpServletResponse res, Context context, String[] params)
        throws IOException {
    // [2]sort for /grades, [3]aid |optional->| [4]our sort, [5]our page, [6]our highest/all-for-uid
    if ((params.length < 4) || params.length > 7)
        throw new IllegalArgumentException();

    // check for user permission to access the assessments for grading
    if (!this.submissionService.allowEvaluate(toolManager.getCurrentPlacement().getContext())) {
        // redirect to error
        res.sendRedirect(res.encodeRedirectURL(Web.returnUrl(req, "/error/" + Errors.unauthorized)));
        return;
    }

    // grades sort parameter
    String gradesSortCode = params[2];
    context.put("sort_grades", gradesSortCode);

    // get Assessment
    Assessment assessment = this.assessmentService.getAssessment(params[3]);
    if (assessment == null) {
        // redirect to error
        res.sendRedirect(res.encodeRedirectURL(Web.returnUrl(req, "/error/" + Errors.invalid)));
        return;
    }
    context.put("assessment", assessment);

    // sort parameter
    String sortCode = null;
    if (params.length > 4)
        sortCode = params[4];
    SubmissionService.FindAssessmentSubmissionsSort sort = getSort(assessment, context, sortCode);
    context.put("sort", sort.toString());

    // paging parameter
    String pagingParameter = null;
    if (params.length > 5)
        pagingParameter = params[5];
    if (pagingParameter == null) {
        pagingParameter = "1-" + Integer.toString(this.pageSizes.get(0));
    }

    // official or all
    Boolean official = Boolean.TRUE;
    String allUid = "official";
    if ((params.length > 6) && (!params[6].equals("official"))) {
        allUid = params[6];
    }

    // for a survey, ignore official
    if (assessment.getType() == AssessmentType.survey) {
        official = Boolean.FALSE;
        allUid = null;
    }

    // get the size
    Integer maxSubmissions = this.submissionService.countAssessmentSubmissions(assessment, official, allUid);

    // paging
    Paging paging = uiService.newPaging();
    paging.setMaxItems(maxSubmissions);
    paging.setCurrentAndSize(pagingParameter);
    context.put("paging", paging);

    // get all Assessment submissions
    List<Submission> submissions = this.submissionService.findAssessmentSubmissions(assessment, sort, official,
            allUid, paging.getSize() == 0 ? null : paging.getCurrent(),
            paging.getSize() == 0 ? null : paging.getSize());
    context.put("submissions", submissions);
    context.put("view", allUid);

    // pages sizes
    if (this.pageSizes.size() > 1) {
        context.put("pageSizes", this.pageSizes);
    }

    uiService.render(ui, context);
}

From source file:com.silverpeas.peasUtil.GoTo.java

@Override
public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
    SilverTrace.info("peasUtil", "GoTo.doPost", "root.MSG_GEN_ENTER_METHOD");
    String id = getObjectId(req);

    try {/*from  w w  w  .  j  a  v a2  s  .  co  m*/
        SilverTrace.info("peasUtil", "GoTo.doPost", "root.MSG_GEN_PARAM_VALUE", "id = " + id);

        String redirect = getDestination(id, req, res);
        if (!StringUtil.isDefined(redirect)) {
            objectNotFound(req, res);
        } else {
            if (!res.isCommitted()) {
                // The response was not previously sent
                if (redirect == null || !redirect.startsWith("http")) {
                    redirect = URLManager.getApplicationURL() + "/autoRedirect.jsp?" + redirect;
                }
                res.sendRedirect(res.encodeRedirectURL(redirect));
            }
        }
    } catch (AccessForbiddenException afe) {
        accessForbidden(req, res);
    } catch (Exception e) {
        objectNotFound(req, res);
    }
}

From source file:org.etudes.mneme.tool.ImportOfflineView.java

/**
 * {@inheritDoc}/*  w ww .  ja  va  2s  .c  o  m*/
 */
public void post(HttpServletRequest req, HttpServletResponse res, Context context, String[] params)
        throws IOException {
    String returnUrl = (params.length > 3) ? params[2] : "";
    String sort = (params.length > 3) ? params[3] : "0A";

    String siteId = toolManager.getCurrentPlacement().getContext();
    if (!this.assessmentService.allowManageAssessments(siteId)) {
        // redirect to error
        res.sendRedirect(res.encodeRedirectURL(Web.returnUrl(req, "/error/" + Errors.unauthorized)));
        return;
    }

    Site site = null;
    try {
        site = this.siteService.getSite(siteId);
    } catch (IdUnusedException e) {
        // redirect to error
        res.sendRedirect(res.encodeRedirectURL(Web.returnUrl(req, "/error/" + Errors.unauthorized)));
        return;
    }

    String iidCode = this.rosterService.findInstitutionCode(site.getTitle());

    // a CSV uploader for the CSV file
    UploadCsv upload = new UploadCsv();
    context.put("upload", upload);

    // read the form
    String destination = uiService.decode(req, context);

    // import the offlines
    if ("UPLOAD".equals(destination)) {
        List<GradeImportSet> importSets = new ArrayList<GradeImportSet>(1);

        // get the Tool session, where we will be storing this until confirmed
        ToolSession toolSession = sessionManager.getCurrentToolSession();
        toolSession.setAttribute(GradeImportSet.ATTR_NAME, importSets);

        // col 0, the student id col 1 .. n, the title of the offline assessment, in the first record, and the score, in the rest
        List<CSVRecord> records = upload.getRecords();

        if ((records != null) && (records.size() > 1)) {
            // the header record
            CSVRecord header = records.get(0);

            // find the "Student ID" column
            int idCol = -1;
            for (int c = 0; c < header.size(); c++) {
                // get the assessment title, extras
                String title = StringUtil.trimToZero(header.get(c));
                if ("Student ID".equalsIgnoreCase(title)) {
                    idCol = c;
                    break;
                }
            }

            if (idCol != -1) {
                // try all other columns
                for (int i = 0; i < header.size(); i++) {
                    // we use this column for the Student ID
                    if (i == idCol)
                        continue;

                    // we will keep this ONLY if we see at least one valid grade entry
                    GradeImportSet set = new GradeImportSet();
                    boolean hasValidEntries = false;

                    // get the assessment title, points
                    String title = StringUtil.trimToZero(header.get(i));
                    Float points = null;
                    int extraPos = title.indexOf("{{");
                    if (extraPos != -1) {
                        String extra = StringUtil.trimToZero(title.substring(extraPos + 2, title.length() - 2));
                        title = StringUtil.trimToZero(title.substring(0, extraPos));
                        try {
                            points = Float.valueOf(extra);
                        } catch (NumberFormatException e) {
                        }
                    }

                    // skip blank header columns
                    if (title.length() == 0)
                        continue;

                    // these two titles we also skip, as created by UCB Gradebook's export
                    if ("Section ID".equals(title))
                        continue;
                    if ("Cumulative".equals(title))
                        continue;

                    // new assessment or existing
                    Assessment existing = assessmentService.assessmentExists(siteId, title);
                    if (existing != null) {
                        // just ignore if it does not take points
                        if (!existing.getHasPoints()) {
                            continue;
                        }
                        set.assessment = existing;
                    } else {
                        set.assessmentTitle = title;
                        set.points = points;
                    }

                    for (CSVRecord r : records) {
                        // skip the header
                        if (r.getRecordNumber() == 1)
                            continue;

                        GradeImport x = new GradeImport();
                        set.rows.add(x);

                        if (r.size() >= 1) {
                            x.studentId = r.get(idCol);
                        }
                        if (r.size() > i) {
                            x.scoreGiven = r.get(i);
                        }

                        if (x.scoreGiven != null) {
                            try {
                                x.score = Float.parseFloat(x.scoreGiven);
                            } catch (NumberFormatException e) {
                            }
                        }

                        if ((x.score != null) & (x.studentId != null)) {
                            // use value in paren, if there
                            String id = x.studentId;
                            int parenPos = id.indexOf("(");
                            if (parenPos != -1) {
                                id = StringUtil.trimToZero(id.substring(parenPos + 1, id.length() - 1));
                            }

                            User user = findIdentifiedStudentInSite(id, siteId, iidCode);
                            if (user != null) {
                                // check for duplicate records
                                boolean duplicate = false;
                                for (GradeImport gi : set.rows) {
                                    if (gi == x)
                                        continue;
                                    if (gi.userId == null)
                                        continue;
                                    if (gi.userId.equals(user.getId())) {
                                        duplicate = true;
                                        x.duplicate = Boolean.TRUE;
                                        break;
                                    }
                                }

                                if (!duplicate) {
                                    x.userId = user.getId();
                                    x.name = user.getDisplayName();
                                    hasValidEntries = true;
                                }
                            }
                        }
                    }

                    // keep this ONLY if we see at least one valid grade entry
                    if (hasValidEntries) {
                        importSets.add(set);
                    }
                }
            }
        }

        destination = "/confirm_grades_import/" + returnUrl + "/" + sort;
    }

    res.sendRedirect(res.encodeRedirectURL(Web.returnUrl(req, destination)));
}

From source file:org.etudes.mneme.tool.SubmittedView.java

/**
 * {@inheritDoc}/*from   www  .  j a  v  a2s  .  c  om*/
 */
public void get(HttpServletRequest req, HttpServletResponse res, Context context, String[] params)
        throws IOException {
    // we need a single parameter (sid) then return
    if (params.length < 3) {
        throw new IllegalArgumentException();
    }

    String submissionId = params[2];
    String destination = null;
    if (params.length > 3) {
        destination = "/" + StringUtil.unsplit(params, 3, params.length - 3, "/");
    }

    // if not specified, go to the main list view
    else {
        destination = "/list";
    }
    context.put("return", destination);

    Submission submission = submissionService.getSubmission(submissionId);
    if (submission == null) {
        // redirect to error
        res.sendRedirect(res.encodeRedirectURL(Web.returnUrl(req, "/error/" + Errors.unauthorized)));
        return;
    }

    // make sure this is a completed submission
    if (!submission.getIsComplete()) {
        // redirect to error
        res.sendRedirect(res.encodeRedirectURL(Web.returnUrl(req, "/error/" + Errors.unauthorized)));
        return;
    }

    // if we have no authored submitted presentation, skip right to ...
    if (submission.getAssessment().getSubmitPresentation() == null) {
        // if the assessment review is allowed, go to review, else to the return destination
        String dest = destination;
        if (submission.getMayReview()) {
            dest = "/review/" + submission.getId() + destination;
        }

        // redirect
        res.sendRedirect(res.encodeRedirectURL(Web.returnUrl(req, dest)));
        return;
    }

    context.put("submission", submission);

    // for the tool navigation
    if (this.assessmentService.allowManageAssessments(toolManager.getCurrentPlacement().getContext())) {
        context.put("maintainer", Boolean.TRUE);
    }

    // render
    uiService.render(ui, context);
}

From source file:org.etudes.mneme.tool.GradeSubmissionView.java

/**
 * {@inheritDoc}/*  www  .  j  a  v a  2 s. c  o  m*/
 */
public void get(HttpServletRequest req, HttpServletResponse res, Context context, String[] params)
        throws IOException {
    // [2]sid, [3] paging, [4] anchor, [5]next/prev sort (optional- leave out to disable next/prev), optionally followed by a return destination
    if (params.length < 5)
        throw new IllegalArgumentException();

    Submission submission = this.submissionService.getSubmission(params[2]);
    if (submission == null) {
        res.sendRedirect(res.encodeRedirectURL(Web.returnUrl(req, "/error/" + Errors.invalid)));
        return;
    }

    // check for user permission to access the submission for grading
    if (!this.submissionService.allowEvaluate(submission)) {
        // redirect to error
        res.sendRedirect(res.encodeRedirectURL(Web.returnUrl(req, "/error/" + Errors.unauthorized)));
        return;
    }

    // check that the assessment is not a formal course evaluation
    if (submission.getAssessment().getFormalCourseEval()) {
        res.sendRedirect(res.encodeRedirectURL(Web.returnUrl(req, "/error/" + Errors.unauthorized)));
        return;
    }

    // validity check
    if (!submission.getAssessment().getIsValid()) {
        res.sendRedirect(res.encodeRedirectURL(Web.returnUrl(req, "/error/" + Errors.unauthorized)));
        return;
    }

    context.put("submission", submission);

    // next and prev, based on the sort
    String sortCode = "userName_a";
    SubmissionService.FindAssessmentSubmissionsSort sort = null;
    int destinationStartsAt = 6;
    if (params.length > 4)
        sortCode = params[5];
    try {
        sort = SubmissionService.FindAssessmentSubmissionsSort.valueOf(sortCode);
    } catch (IllegalArgumentException e) {
        // no sort, so it must be part of destination
        destinationStartsAt = 5;
        sortCode = "userName_a";
    }
    if (sort != null) {
        // check the "official / all" parameter from the return for "official", except for survey, where we consider them all
        Boolean official = Boolean.FALSE;
        if ((params.length > 11) && ("official".equals(params[11]))
                && (submission.getAssessment().getType() != AssessmentType.survey)) {
            official = Boolean.TRUE;
        }

        Ordering<String> nextPrev = submissionService.findPrevNextSubmissionIds(submission, sort, official);

        if (nextPrev.getPrevious() != null)
            context.put("prev", nextPrev.getPrevious());
        if (nextPrev.getNext() != null)
            context.put("next", nextPrev.getNext());
        context.put("position", nextPrev.getPosition());
        context.put("size", nextPrev.getSize());
    }
    context.put("sort", sortCode);

    String destination = null;
    if (params.length > destinationStartsAt) {
        destination = "/"
                + StringUtil.unsplit(params, destinationStartsAt, params.length - destinationStartsAt, "/");
    }

    // if not specified, go to the main grade_assessment page for this assessment
    else {
        destination = "/grade_assessment/0A/" + submission.getAssessment().getId();
    }
    context.put("return", destination);

    // paging parameter
    String pagingParameter = null;
    if (params.length > 3)
        pagingParameter = params[3];
    if ((pagingParameter == null) || (pagingParameter.length() == 0) || (pagingParameter.equals("-"))) {
        pagingParameter = "1-" + Integer.toString(this.defaultPageSize);
    }

    // paging
    Paging paging = uiService.newPaging();
    paging.setMaxItems(submission.getAnswers().size());
    paging.setCurrentAndSize(pagingParameter);
    context.put("paging", paging);

    // pages sizes
    if (this.pageSizes.size() > 1) {
        context.put("pageSizes", this.pageSizes);
    }

    // pick the page of answers
    List<Answer> answers = submission.getAnswers();
    if (paging.getSize() != 0) {
        // start at ((pageNum-1)*pageSize)
        int start = ((paging.getCurrent().intValue() - 1) * paging.getSize().intValue());
        if (start < 0)
            start = 0;
        if (start > answers.size())
            start = answers.size() - 1;

        // end at ((pageNum)*pageSize)-1, or max-1, (note: subList is not inclusive for the end position)
        int end = paging.getCurrent().intValue() * paging.getSize().intValue();
        if (end < 0)
            end = 0;
        if (end > answers.size())
            end = answers.size();

        answers = answers.subList(start, end);
    }
    context.put("answers", answers);

    String anchor = params[4];
    if (!anchor.equals("-"))
        context.put("anchor", anchor);

    // needed by some of the delegates to show the score
    context.put("grading", Boolean.TRUE);
    new CKSetup().setCKCollectionAttrib(getDocsPath(), toolManager.getCurrentPlacement().getContext());

    uiService.render(ui, context);
}

From source file:org.etudes.mneme.tool.FinalReviewView.java

/**
 * {@inheritDoc}/*from  w  w w  .  ja  v a  2s .  c om*/
 */
public void get(HttpServletRequest req, HttpServletResponse res, Context context, String[] params)
        throws IOException {
    // sid and return
    if (params.length < 3) {
        throw new IllegalArgumentException();
    }

    String submissionId = params[2];
    String destination = null;
    if (params.length > 3) {
        destination = "/" + StringUtil.unsplit(params, 3, params.length - 3, "/");
    }

    // if not specified, go to the main list view
    else {
        destination = "/list";
    }
    context.put("return", destination);

    // collect the submission
    Submission submission = submissionService.getSubmission(submissionId);
    if (submission == null) {
        // redirect to error
        res.sendRedirect(res.encodeRedirectURL(Web.returnUrl(req, "/error/" + Errors.invalid)));
        return;
    }

    if (!submissionService.allowCompleteSubmission(submission)) {
        // redirect to error
        res.sendRedirect(res.encodeRedirectURL(Web.returnUrl(req, "/error/" + Errors.unauthorized)));
        return;
    }
    context.put("submission", submission);

    context.put("finalReview", Boolean.TRUE);

    // for the tool navigation
    if (this.assessmentService.allowManageAssessments(toolManager.getCurrentPlacement().getContext())) {
        context.put("maintainer", Boolean.TRUE);
    }

    // render
    uiService.render(ui, context);
}

From source file:org.muse.mneme.tool.GradeQuestionView.java

/**
 * {@inheritDoc}//from  w w w .  ja  v a  2s .  c  o m
 */
public void post(HttpServletRequest req, HttpServletResponse res, Context context, String[] params)
        throws IOException {
    // [2]grades sort code, [3]aid, [4]qid, |optional ->| [5]sort, [6]page, [7] anchor
    if (params.length < 5)
        throw new IllegalArgumentException();

    // check for user permission to access the assessments for grading
    if (!this.submissionService.allowEvaluate(toolManager.getCurrentPlacement().getContext())) {
        // redirect to error
        res.sendRedirect(res.encodeRedirectURL(Web.returnUrl(req, "/error/" + Errors.unauthorized)));
        return;
    }

    final SubmissionService submissionService = this.submissionService;
    PopulatingSet answers = uiService.newPopulatingSet(new Factory() {
        public Object get(String id) {
            Answer answer = submissionService.getAnswer(id);
            return answer;
        }
    }, new Id() {
        public String getId(Object o) {
            return ((Answer) o).getId();
        }
    });
    context.put("answers", answers);

    // read form
    String destination = this.uiService.decode(req, context);

    // post-process the answers
    for (Object o : answers.getSet()) {
        Answer a = (Answer) o;
        a.getTypeSpecificAnswer().consolidate(destination);
    }

    String newDestination = null;

    // check for remove
    if (destination.startsWith("STAY_REMOVE:")) {
        String[] parts = StringUtil.splitFirst(destination, ":");
        if (parts.length == 2) {
            parts = StringUtil.splitFirst(parts[1], ":");
            if (parts.length == 2) {
                // find the answer, id=parts[0], ref=parts[1]
                for (Object o : answers.getSet()) {
                    Answer answer = (Answer) o;
                    if (answer.getId().equals(parts[0])) {
                        Reference ref = this.attachmentService.getReference(parts[1]);
                        answer.getEvaluation().removeAttachment(ref);
                        this.attachmentService.removeAttachment(ref);
                        break;
                    }
                }
            }
        }
    }

    if (destination.startsWith("STAY_")) {
        String newAnchor = "-";

        String[] parts = StringUtil.splitFirst(destination, ":");
        if (parts.length == 2) {
            String[] anchor = StringUtil.splitFirst(parts[1], ":");
            if (anchor.length > 0) {
                newAnchor = anchor[0];
            }
        }

        // rebuild the current destination with the new anchor
        if (params.length > 7) {
            params[7] = newAnchor;
            destination = StringUtil.unsplit(params, "/");
        } else {
            // assessment
            Assessment assessment = this.assessmentService.getAssessment(params[3]);
            if (assessment == null) {
                res.sendRedirect(res.encodeRedirectURL(Web.returnUrl(req, "/error/" + Errors.invalid)));
                return;
            }

            // sort code
            String sortCode = null;
            if (params.length > 5) {
                sortCode = params[5];
            }
            if (sortCode == null) {
                if (assessment.getAnonymous()) {
                    sortCode = "1A";
                } else {
                    sortCode = "0A";
                }
            }

            // paging parameter
            String pagingParameter = null;
            if (params.length > 6)
                pagingParameter = params[6];
            if (pagingParameter == null) {
                pagingParameter = "1-" + Integer.toString(this.pageSizes.get(0));
            }

            destination = context.getDestination() + "/" + sortCode + "/" + pagingParameter + "/" + newAnchor;
        }
    }

    // save
    try {
        this.submissionService.evaluateAnswers(answers.getSet());
    } catch (AssessmentPermissionException e) {
        // redirect to error
        res.sendRedirect(res.encodeRedirectURL(Web.returnUrl(req, "/error/" + Errors.unexpected)));
        return;
    }

    // if there was an upload error, send to the upload error
    if ((req.getAttribute("upload.status") != null) && (!req.getAttribute("upload.status").equals("ok"))) {
        res.sendRedirect(res.encodeRedirectURL(
                Web.returnUrl(req, "/error/" + Errors.upload + "/" + req.getAttribute("upload.limit"))));
        return;
    }

    res.sendRedirect(res.encodeRedirectURL(Web.returnUrl(req, destination)));
}

From source file:org.acegisecurity.ui.switchuser.SwitchUserProcessingFilter.java

/**
 *
 * @see javax.servlet.Filter#doFilter/*from   w w w . ja  v a2  s.  com*/
 */
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
        throws IOException, ServletException {
    Assert.isInstanceOf(HttpServletRequest.class, request);
    Assert.isInstanceOf(HttpServletResponse.class, response);

    HttpServletRequest httpRequest = (HttpServletRequest) request;
    HttpServletResponse httpResponse = (HttpServletResponse) response;

    // check for switch or exit request
    if (requiresSwitchUser(httpRequest)) {
        // if set, attempt switch and store original
        Authentication targetUser = attemptSwitchUser(httpRequest);

        // update the current context to the new target user
        SecurityContextHolder.getContext().setAuthentication(targetUser);

        // redirect to target url
        httpResponse.sendRedirect(httpResponse.encodeRedirectURL(httpRequest.getContextPath() + targetUrl));

        return;
    } else if (requiresExitUser(httpRequest)) {
        // get the original authentication object (if exists)
        Authentication originalUser = attemptExitUser(httpRequest);

        // update the current context back to the original user
        SecurityContextHolder.getContext().setAuthentication(originalUser);

        // redirect to target url
        httpResponse.sendRedirect(httpResponse.encodeRedirectURL(httpRequest.getContextPath() + targetUrl));

        return;
    }

    chain.doFilter(request, response);
}

From source file:org.muse.mneme.tool.GradeAssessmentView.java

/**
 * {@inheritDoc}/*from  w  w  w  . j a  va2  s  . c  om*/
 */
public void post(HttpServletRequest req, HttpServletResponse res, Context context, String[] params)
        throws IOException {
    // [2]sort for /grades, [3]aid |optional->| [4]our sort, [5]our page, [6]our all/highest
    if ((params.length < 4) || params.length > 7)
        throw new IllegalArgumentException();

    // check for user permission to access the assessments for grading
    if (!this.submissionService.allowEvaluate(toolManager.getCurrentPlacement().getContext())) {
        // redirect to error
        res.sendRedirect(res.encodeRedirectURL(Web.returnUrl(req, "/error/" + Errors.unauthorized)));
        return;
    }

    // for Adjust every student's test submission by
    Value submissionAdjustValue = this.uiService.newValue();
    context.put("submissionAdjust", submissionAdjustValue);

    // for "Adjust every student's test submission by" comments
    Value submissionAdjustCommentsValue = this.uiService.newValue();
    context.put("submissionAdjustComments", submissionAdjustCommentsValue);

    // setup the model: the assessment
    // get Assessment - assessment id is in params at index 3
    Assessment assessment = this.assessmentService.getAssessment(params[3]);
    if (assessment == null) {
        // redirect to error
        res.sendRedirect(res.encodeRedirectURL(Web.returnUrl(req, "/error/" + Errors.invalid)));
        return;
    }

    // for the final scores
    PopulatingSet submissions = null;
    final SubmissionService submissionService = this.submissionService;
    submissions = uiService.newPopulatingSet(new Factory() {
        public Object get(String id) {
            Submission submission = submissionService.getSubmission(id);
            return submission;
        }
    }, new Id() {
        public String getId(Object o) {
            return ((Submission) o).getId();
        }
    });
    context.put("submissions", submissions);

    // read form
    String destination = this.uiService.decode(req, context);

    // save any final scores
    for (Iterator i = submissions.getSet().iterator(); i.hasNext();) {
        try {
            this.submissionService.evaluateSubmission((Submission) i.next());
        } catch (AssessmentPermissionException e) {
            M_log.warn("post: " + e);
        }
    }

    // apply the global adjustments
    String adjustScore = StringUtil.trimToNull(submissionAdjustValue.getValue());
    String adjustComments = StringUtil.trimToNull(submissionAdjustCommentsValue.getValue());
    if (adjustScore != null || adjustComments != null) {
        try {
            // parse the score
            Float score = null;
            if (adjustScore != null) {
                score = Float.parseFloat(adjustScore);
            }

            // apply (no release)
            this.submissionService.evaluateSubmissions(assessment, adjustComments, score);
        } catch (AssessmentPermissionException e) {
            M_log.warn("post: " + e);
        } catch (NumberFormatException e) {
        }
    }

    // release all evaluated
    if (destination.equals("RELEASEEVALUATED")) {
        try {
            this.submissionService.releaseSubmissions(assessment, Boolean.TRUE);
        } catch (AssessmentPermissionException e) {
            M_log.warn("post: " + e);
        }

        destination = context.getDestination();
    }

    else if (destination.equals("RELEASEALL")) {
        try {
            this.submissionService.releaseSubmissions(assessment, Boolean.FALSE);
        } catch (AssessmentPermissionException e) {
            M_log.warn("post: " + e);
        }

        destination = context.getDestination();
    }

    else if (destination.equals("SAVE")) {
        destination = context.getDestination();
    }

    res.sendRedirect(res.encodeRedirectURL(Web.returnUrl(req, destination)));
}