Example usage for org.springframework.web.bind.support SessionStatus setComplete

List of usage examples for org.springframework.web.bind.support SessionStatus setComplete

Introduction

In this page you can find the example usage for org.springframework.web.bind.support SessionStatus setComplete.

Prototype

void setComplete();

Source Link

Document

Mark the current handler's session processing as complete, allowing for cleanup of session attributes.

Usage

From source file:nl.surfnet.coin.teams.control.InvitationController.java

/**
 * RequestMapping to delete an invitation as admin
 *
 *
 * @param request// w  ww  .  j a v a2 s .c  o  m
 *          {@link javax.servlet.http.HttpServletRequest}
 * @return redirect to detailteam if everything is okay
 * @throws UnsupportedEncodingException
 *           in the rare condition utf-8 is not supported
 */
@RequestMapping(value = "/deleteInvitation.shtml")
public RedirectView deleteInvitation(HttpServletRequest request,
        @ModelAttribute(TokenUtil.TOKENCHECK) String sessionToken, @RequestParam() String token,
        SessionStatus status, ModelMap modelMap) throws UnsupportedEncodingException {
    TokenUtil.checkTokens(sessionToken, token, status);
    Person person = (Person) request.getSession().getAttribute(LoginInterceptor.PERSON_SESSION_KEY);

    if (person == null) {
        status.setComplete();
        return new RedirectView("landingpage.shtml");
    }
    Invitation invitation = getAllInvitationByRequest(request);
    String teamId = invitation.getTeamId();

    if (!controllerUtil.hasUserAdministrativePrivileges(person, teamId)) {
        throw new RuntimeException("Requester (" + person.getId()
                + ") is not member or does not have the correct " + "privileges to delete (a) member(s)");
    }

    teamInviteService.delete(invitation);
    AuditLog.log("User {} deleted invitation for email {} for team {} with intended role {}", person.getId(),
            invitation.getEmail(), invitation.getTeamId(), invitation.getIntendedRole());

    status.setComplete();
    modelMap.clear();
    return new RedirectView("detailteam.shtml?team=" + URLEncoder.encode(teamId, "utf-8") + "&view="
            + ViewUtil.getView(request));
}

From source file:csns.web.controller.OnlineAssignmentControllerS.java

@RequestMapping(value = "/assignment/online/editQuestionSection", method = RequestMethod.POST)
public String editQuestionSection(@ModelAttribute QuestionSection questionSection,
        @RequestParam Long assignmentId, @RequestParam int sectionIndex, SessionStatus sessionStatus) {
    OnlineAssignment assignment = (OnlineAssignment) assignmentDao.getAssignment(assignmentId);
    assignment.getQuestionSheet().getSections().set(sectionIndex, questionSection);
    assignmentDao.saveAssignment(assignment);

    logger.info(SecurityUtils.getUser().getUsername() + " edited section " + sectionIndex
            + " in online assignment " + assignmentId);

    sessionStatus.setComplete();
    return "redirect:/assignment/online/editQuestionSheet?assignmentId=" + assignmentId + "&sectionIndex="
            + sectionIndex;/*from  ww w.  j  a va2s . co  m*/
}

From source file:csns.web.controller.MailinglistMessageControllerS.java

@RequestMapping(value = "/department/{dept}/mailinglist/message/compose", method = RequestMethod.POST)
public String compose(@ModelAttribute Message message, @PathVariable String dept,
        @RequestParam(value = "file", required = false) MultipartFile[] uploadedFiles, BindingResult result,
        SessionStatus sessionStatus, ModelMap models) {
    messageValidator.validate(message, result);
    if (result.hasErrors())
        return "mailinglist/message/compose";

    User user = SecurityUtils.getUser();
    message.setAuthor(user);/*from ww  w.j a  va2 s. c  o  m*/
    message.setDate(new Date());
    if (uploadedFiles != null)
        message.getAttachments().addAll(fileIO.save(uploadedFiles, user, true));

    message = messageDao.saveMessage(message);
    massMailSender.send(message, message.getMailinglist());

    sessionStatus.setComplete();
    return "redirect:/department/" + dept + "/mailinglist/view?id=" + message.getMailinglist().getId();
}

From source file:org.openmrs.module.metadatasharing.web.controller.ImportController.java

@RequestMapping(value = UPLOAD_PATH, method = RequestMethod.GET)
public void upload(SessionStatus status) {
    status.setComplete();
}

From source file:org.jasig.portlet.ClassifiedsPortlet.web.SubmitHeadingFormController.java

@RequestMapping(params = "action=addHeading")
protected void processFormSubmission(@ModelAttribute("heading") Heading heading, BindingResult result,
        SessionStatus status, ActionRequest request, ActionResponse response, Model model)
        throws PortletException {

    new SubmitHeadingFormValidator().validate(heading, result);
    if (result.hasErrors()) {
        response.setRenderParameter("action", "addHeading");
        return;//from  w  ww  .ja v  a 2s  . c o m
    }

    if (!result.hasErrors() && heading != null) {

        if (log.isDebugEnabled())
            log.debug("No errors in form");

        headingService.processHeading(heading);

        status.setComplete();

        response.setRenderParameter("action", "editHeadings");
    }
}

From source file:egovframework.oe1.cms.cmm.web.EgovOe1FrmwrkInfoManageController.java

/**
 * ? //  www.ja va  2 s . c o  m
 * @param EgovOe1FrmwrkInfoManageVO
 * @return "/cms/cmm/frmwrkInfoList.do"
 * @exception Exception
 */
@RequestMapping("/cms/cmm/frmwrkInfoDelete.do")
public String deleteFrmwrkInfoManage(@ModelAttribute("frmwrkInfoVO") EgovOe1FrmwrkInfoManageVO frmwrkInfoVo,
        SessionStatus status) throws Exception {

    //?
    egovOe1FrmwrkInfoManageService.deleteFrmwrkInfoManage(frmwrkInfoVo);

    status.setComplete();
    return "forward:/cms/cmm/frmwrkInfoList.do";
}

From source file:csns.web.controller.RubricControllerS.java

@RequestMapping(value = "/department/{dept}/rubric/addIndicator", method = RequestMethod.POST)
public String addIndicator(@ModelAttribute("indicator") RubricIndicator indicator, @RequestParam Long rubricId,
        BindingResult result, SessionStatus sessionStatus) {
    rubricIndicatorValidator.validate(indicator, result);
    if (result.hasErrors())
        return "rubric/addIndicator";

    Rubric rubric = rubricDao.getRubric(rubricId);
    if (!rubric.isPublished()) {
        rubric.getIndicators().add(indicator);
        rubric = rubricDao.saveRubric(rubric);
        logger.info(SecurityUtils.getUser().getUsername() + " added rubric indicator " + indicator.getId());
    }/*ww w .ja va 2  s  .  com*/

    sessionStatus.setComplete();
    return "redirect:view?id=" + rubricId;
}

From source file:org.cloudfoundry.identity.uaa.login.RemoteUaaController.java

@RequestMapping(value = "/oauth/authorize", method = RequestMethod.POST, params = "user_oauth_approval")
@ResponseBody/*  w  ww.j  a va2s .  c  om*/
public ResponseEntity<byte[]> approveOrDeny(HttpServletRequest request, HttpEntity<byte[]> entity,
        Map<String, Object> model, SessionStatus sessionStatus) throws Exception {
    sessionStatus.setComplete();
    return passthru(request, entity, model, false);
}

From source file:csns.web.controller.SurveyChartControllerS.java

@RequestMapping(value = "/department/{dept}/survey/chart/create", method = RequestMethod.POST)
public String create(@ModelAttribute("chart") SurveyChart chart, @PathVariable String dept,
        BindingResult result, SessionStatus sessionStatus) {
    surveyChartValidator.validate(chart, result);
    if (result.hasErrors())
        return "survey/chart/create";

    User user = SecurityUtils.getUser();
    chart.setAuthor(user);/*w  w  w.  ja  v  a  2  s .com*/
    chart.setDepartment(departmentDao.getDepartment(dept));
    chart = surveyChartDao.saveSurveyChart(chart);

    logger.info(user.getUsername() + " created survey chart " + chart.getId());

    sessionStatus.setComplete();
    return "redirect:view?id=" + chart.getId();
}

From source file:org.jblogcms.core.post.controller.AddPostController.java

/**
 * Submits form for adding new post/*from w  ww .j  av a  2  s.  co m*/
 *
 * @param postForm the new post
 * @param result   the {@code BindingResult} object
 * @param status   the {@code SessionStatus} object
 * @param model    the {@code Model} object
 * @return logical String-based view name
 */
@PreAuthorize("hasRole('ROLE_USER')")
@RequestMapping(value = "/post/add", method = RequestMethod.POST)
public String addPostSubmitForm(@Valid @ModelAttribute("post") Post postForm, BindingResult result,
        SessionStatus status, Model model) {

    if (result.hasErrors()) {
        model.addAttribute("allBlogs", blogService.findBlogList(null));

        return "admin/postAdd";
    } else {
        Long currentAccountId = securityService.getCurrentAccountId();
        Post post = addPost(postForm, currentAccountId, result);
        if (post == null) {
            model.addAttribute("allBlogs", blogService.findBlogList(null));
            return "admin/postAdd";
        }
        status.setComplete();

        return "redirect:/";
    }
}