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:com.work.petclinic.web.VisitController.java

@RequestMapping(value = "/owners/{ownerId}/pets/{petId}/visits/new", method = RequestMethod.POST)
public String processNewVisitForm(@Valid Visit visit, BindingResult result, SessionStatus status) {
    if (result.hasErrors()) {
        return "pets/visitForm";
    } else {/*www.  j ava  2  s .  com*/
        this.clinicService.saveVisit(visit);
        status.setComplete();
        return "redirect:/owners/{ownerId}";
    }
}

From source file:id.go.kemdikbud.tandajasa.controller.PegawaiController.java

@RequestMapping(value = "/pegawai/form", method = RequestMethod.POST)
public String prosesForm(@ModelAttribute @Valid Pegawai pegawai, BindingResult errors, SessionStatus status) {
    if (errors.hasErrors()) {
        return "/pegawai/form";
    }//from  ww  w  .  j av a2 s  . c  om

    pegawaiDao.save(pegawai);
    status.setComplete();
    return "redirect:list";
}

From source file:org.sloth.web.report.DeleteReportController.java

/**
 * Handles the {@code POST} request and deletes the observation.
 *//*from  ww  w. j a  va 2s  .  c o  m*/
@RequestMapping(method = RequestMethod.POST)
public String handlePost(@PathVariable Long id, SessionStatus status, HttpSession session,
        HttpServletResponse response) throws IOException {
    status.setComplete();
    Report report = this.observationService.getReport(id);
    if (report == null) {
        return notFoundView(response);
    } else {
        if (isAdmin(session) || isOwnReport(session, report)) {
            try {
                this.observationService.deleteReport(report);
            } catch (Exception e) {
                logger.warn("Unexpected Exception", e);
                return internalErrorView(response);
            } finally {
                status.setComplete();
            }
            return "redirect:/r";
        } else {
            return forbiddenView(response);
        }
    }
}

From source file:com.realdolmen.rdfleet.webmvc.controllers.rd.OrderCarController.java

@RequestMapping(value = "/cancelOrder", method = RequestMethod.POST)
public String cancelOrder(@ModelAttribute("employeeCar") EmployeeCar employeeCar,
        @ModelAttribute("order") Order order, SessionStatus status) {
    if (!canOrderNewCar() || order == null)
        return "redirect:/index";
    status.setComplete();
    return "redirect:/rd/cars?type=order";
}

From source file:cherry.example.web.basic.ex60.BasicEx61ControllerImpl.java

@Override
public ModelAndView start(BasicEx61SessionForm form, BindingResult binding, Authentication auth, Locale locale,
        SitePreference sitePref, NativeWebRequest request, SessionStatus status) {
    if (binding.hasErrors()) {
        status.setComplete();
        return redirect(redirectToSearchResult()).build();
    }/*from ww  w  .j  a  v a 2s  .co  m*/
    BasicEx61Form f = createForm(form);
    if (f.getItem().isEmpty()) {
        status.setComplete();
        return redirect(redirectToSearchResult()).build();
    }
    return withViewname(viewnameOfStart).addObject(f).build();
}

From source file:com.work.petclinic.web.PetController.java

@RequestMapping(value = "/owners/{ownerId}/pets/new", method = RequestMethod.POST)
public String processCreationForm(@Valid Pet pet, BindingResult result, SessionStatus status) {
    if (result.hasErrors()) {
        return "pets/petForm";
    } else {/*from  www.  j  a  va2 s.  c  o m*/
        this.clinicService.savePet(pet);
        status.setComplete();
        return "redirect:/owners/{ownerId}";
    }
}

From source file:com.work.petclinic.web.PetController.java

@RequestMapping(value = "/owners/{ownerId}/pets/{petId}/edit", method = RequestMethod.POST)
public String processUpdateForm(@Valid Pet pet, BindingResult result, SessionStatus status) {
    if (result.hasErrors()) {
        return "pets/petForm";
    } else {/*w  w w  .  j av  a  2s  . c om*/
        this.clinicService.savePet(pet);
        status.setComplete();
        return "redirect:/owners/{ownerId}";
    }
}

From source file:cherry.example.web.applied.ex50.AppliedEx51ControllerImpl.java

@Override
public ModelAndView start(AppliedEx51SessionForm form, BindingResult binding, Authentication auth,
        Locale locale, SitePreference sitePref, NativeWebRequest request, SessionStatus status) {
    if (binding.hasErrors()) {
        status.setComplete();
        return redirect(redirectToSearchResult()).build();
    }/*from  w w  w . jav a 2s .c  o m*/
    AppliedEx51Form f = createForm(form);
    if (f.getItem().isEmpty()) {
        status.setComplete();
        return redirect(redirectToSearchResult()).build();
    }
    return withViewname(viewnameOfStart).addObject(f).build();
}

From source file:com.rambird.web.VisitController.java

@RequestMapping(value = "/owners/{ownerId}/pets/{petId}/visits/new", method = RequestMethod.POST)
public String processNewVisitForm(@Valid Visit visit, BindingResult result, SessionStatus status) {
    if (result.hasErrors()) {
        return "pets/createOrUpdateVisitForm";
    } else {/*from  w w  w . ja v a  2  s  . c  o m*/
        this.clinicService.saveVisit(visit);
        status.setComplete();
        return "redirect:/owners/{ownerId}";
    }
}

From source file:lcn.samples.petclinic.controller.VisitController.java

@RequestMapping(value = "/owners/{ownerId}/pets/{petId}/visits/new", method = RequestMethod.POST)
public String processNewVisitForm(@Valid Visit visit, BindingResult result, SessionStatus status) {
    if (result.hasErrors()) {
        return "pets/createOrUpdateVisitForm";
    } else {//w w  w .j a v a 2  s  . c o m
        this.clinicService.saveVisit(visit);
        status.setComplete();
        return "redirect:/owners/{ownerId}.do";
    }
}