本文整理匯總了Java中org.springframework.web.bind.support.SessionStatus類的典型用法代碼示例。如果您正苦於以下問題:Java SessionStatus類的具體用法?Java SessionStatus怎麽用?Java SessionStatus使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
SessionStatus類屬於org.springframework.web.bind.support包,在下文中一共展示了SessionStatus類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: logonMethod
import org.springframework.web.bind.support.SessionStatus; //導入依賴的package包/類
@RequestMapping(value = "/logon.sf", method = RequestMethod.POST)
public String logonMethod(
@ModelAttribute("logon") Logon logon,
BindingResult result, SessionStatus status) {
logonValidator.validate(logon, result);
if (result.hasErrors()) {
//if validator failed
return "login";
} else {
status.setComplete();
//form success
return "securepage";
}
}
示例2: deleteProfileImage
import org.springframework.web.bind.support.SessionStatus; //導入依賴的package包/類
@RequestMapping(value = "/users/upload", params = {"deleteImage"}, method = RequestMethod.POST)
public String deleteProfileImage(CurrentUser currentUser, RedirectAttributes attributes,
Model model, SessionStatus status) {
logger.info("Removing Profile Image for user: {}", currentUser.getUser().getUsername());
String profileRedirectUrl = String.format("redirect:/%s", currentUser.getUsername());
ProfileImageDTO profileImageDTO = new ProfileImageDTO();
model.addAttribute("profileImageDTO", profileImageDTO);
userService.updateHasAvatar(currentUser.getId(), false);
status.setComplete();
webUI.addFeedbackMessage(attributes, FEEDBACK_MESSAGE_KEY_PROFILE_IMAGE_REMOVED);
return profileRedirectUrl;
}
示例3: handleFileUpload
import org.springframework.web.bind.support.SessionStatus; //導入依賴的package包/類
@RequestMapping(value = "/users/upload", method = RequestMethod.POST)
public String handleFileUpload(@Valid ProfileImageDTO profileImageDTO,
BindingResult result, ModelMap model, CurrentUser currentUser,
RedirectAttributes attributes, SessionStatus status) throws IOException {
String profileRedirectUrl = String.format("redirect:/user/%s?ico", currentUser.getUsername());
if (result.hasErrors()) {
logger.info("Profile Image Errors for: {}", profileImageDTO.getFile().getOriginalFilename());
return USER_PROFILE_VIEW;
} else {
logger.debug("Fetching file");
MultipartFile multipartFile = profileImageDTO.getFile();
String userKey = currentUser.getUser().getUserKey();
webUI.processProfileImage(profileImageDTO, userKey);
userService.updateHasAvatar(currentUser.getId(), true);
status.setComplete();
webUI.addFeedbackMessage(attributes, FEEDBACK_MESSAGE_KEY_PROFILE_IMAGE_UPDATED);
return profileRedirectUrl;
}
}
示例4: addUser
import org.springframework.web.bind.support.SessionStatus; //導入依賴的package包/類
@RequestMapping(value = "/users/new", method = RequestMethod.POST)
public String addUser(@Valid UserDTO userDTO,
BindingResult result, SessionStatus status, Model model,
RedirectAttributes attributes) {
if (result.hasErrors()) {
model.addAttribute("authorities", userService.getRoles());
return ADMIN_USERFORM_VIEW;
} else {
userDTO.setSignInProvider(SignInProvider.SITE);
User added = userService.create(userDTO);
logger.info("Added user with information: {}", added);
status.setComplete();
webUI.addFeedbackMessage(attributes, FEEDBACK_MESSAGE_KEY_USER_ADDED, added.getFirstName(),
added.getLastName());
return "redirect:/admin/users";
}
}
示例5: addTag
import org.springframework.web.bind.support.SessionStatus; //導入依賴的package包/類
@RequestMapping(value = "/tags/new", method = RequestMethod.POST)
public String addTag(@Valid TagDTO tagDTO,
BindingResult result,
SessionStatus status,
RedirectAttributes attributes) {
if (result.hasErrors()) {
return ADMIN_TAGS_VIEW;
} else {
Tag tag = postService.createTag(tagDTO);
logger.info("Tag Added: {}", tag.getTagValue());
status.setComplete();
webUI.addFeedbackMessage(attributes, FEEDBACK_MESSAGE_TAG_ADDED, tag.getTagValue());
return "redirect:/admin/posts/tags";
}
}
示例6: addCategory
import org.springframework.web.bind.support.SessionStatus; //導入依賴的package包/類
@RequestMapping(value = "/categories/new", method = RequestMethod.POST)
public String addCategory(@Valid CategoryDTO categoryDTO,
BindingResult result,
SessionStatus status,
RedirectAttributes attributes) {
if (result.hasErrors()) {
return ADMIN_CATEGORIES_VIEW;
} else {
Category category = postService.createCategory(categoryDTO);
logger.info("Category Added: {}", category.getCategoryValue());
status.setComplete();
webUI.addFeedbackMessage(attributes, FEEDBACK_MESSAGE_CATEGORY_ADDED, category.getCategoryValue());
return "redirect:/admin/posts/categories";
}
}
示例7: processPetCreationForm
import org.springframework.web.bind.support.SessionStatus; //導入依賴的package包/類
@PostMapping("new")
public String processPetCreationForm(
@Valid @ModelAttribute Pet pet,
BindingResult bindingResult,
Model model,
@ModelAttribute("id") int petId,
SessionStatus sessionStatus) {
logger.debug("processPetCreationForm()");
if (bindingResult.hasErrors()) {
model.addAttribute("mode", FormMode.Edit);
return "pet/viewOrEdit";
}
if (petId != -1) {
pet.setId(petId);
petRepository.update(pet);
} else {
petId = petRepository.insert(pet);
}
sessionStatus.setComplete();
return "redirect:/pets/" + petId;
}
示例8: processCreationForm
import org.springframework.web.bind.support.SessionStatus; //導入依賴的package包/類
@RequestMapping(value = "/contato/new", method = RequestMethod.POST)
public String processCreationForm(@Valid Contato contato, BindingResult result,
SessionStatus status, RedirectAttributes redirectAttributes) {
if (result.hasErrors()) {
System.out.println("Contato in if");
System.out.println("Contato " + result.toString());
return "contato/contatoForm";
} else {
System.out.println("Contato in else");
repository.save(contato);
String msginfo = "<script>$(document).ready(function() {toastr.success('Contato incluído com sucesso !');});</script>";
redirectAttributes.addFlashAttribute("msginfo", msginfo);
status.setComplete();
return "redirect:/contato";
}
}
示例9: createGlobeSite
import org.springframework.web.bind.support.SessionStatus; //導入依賴的package包/類
/**
* The final step (dashboard) of the new site registration route, if the GLOBE survey was not skipped.
*
* @param site The site that exists in the model with fields populated by what the user
* entered into the form on the second page.
* @param sessionStatus The session module for the new site registration route.
* @param answers An array of GLOBE survey answers.
* @return A redirect command to the dashboard.
*/
@RequestMapping(params = "_finish_globe", method = RequestMethod.POST)
public String createGlobeSite(
@ModelAttribute("site") Site site,
SessionStatus sessionStatus,
@RequestParam("answers") String[] answers)
{
// Persist the site.
siteService.save(site);
// I'm sure there is a better way of persisting GLOBE answers.
for (byte i = 0; i < answers.length; i++) {
Globe globe = new Globe();
globe.setSite(site);
globe.setSiteID(site.getId());
globe.setAnswer(answers[i]);
globe.setQuestion_number((byte)(i + 1));
globeRepository.save(globe);
}
// Set the session complete, as the site has been safely persisted.
sessionStatus.setComplete();
// Redirect to the dashboard.
return "redirect:/dashboard";
}
示例10: restaurar
import org.springframework.web.bind.support.SessionStatus; //導入依賴的package包/類
@RequestMapping(value = "/{tascaId}/restaurar", method = RequestMethod.POST)
public String restaurar(
HttpServletRequest request,
@PathVariable String tascaId,
SessionStatus status,
Model model) {
try {
accioRestaurarForm(request, tascaId);
} catch (Exception ex) {
MissatgesHelper.error(request, ex.getMessage());
logger.error("No s'ha pogut restaurar el formulari en la tasca " + tascaId, ex);
}
status.setComplete();
return mostrarInformacioTascaPerPipelles(
request,
tascaId,
model,
"form");
}
示例11: tokenRetrocedirPost
import org.springframework.web.bind.support.SessionStatus; //導入依賴的package包/類
@RequestMapping(value="/{expedientId}/{tokenId}/tokenRetrocedir", method = RequestMethod.POST)
public String tokenRetrocedirPost(
HttpServletRequest request,
@PathVariable Long expedientId,
@PathVariable String tokenId,
@ModelAttribute TokenExpedientCommand command,
BindingResult result,
SessionStatus status,
Model model) {
try{
new TokenRetrocedirValidator().validate(command, result);
if (result.hasErrors()) {
model.addAttribute("arrivingNodeNames", tokenService.findArrivingNodeNames(expedientId,tokenId.toString()));
return "v3/expedientTokenRetrocedir";
}
tokenService.tokenRetrocedir(expedientId, tokenId, command.getNodeRetrocedir(), command.isCancelar());
MissatgesHelper.success(request, getMessage(request, "info.token.retrocedit") );
} catch (Exception ex) {
MissatgesHelper.error(request, getMessage(request, "error.retrocedir.token", new Object[] {String.valueOf(tokenId)} ));
logger.error("No s'ha pogut retrocedir el token " + String.valueOf(tokenId), ex);
}
return modalUrlTancar(false);
}
示例12: deleteRepro
import org.springframework.web.bind.support.SessionStatus; //導入依賴的package包/類
@RequestMapping(value = "/{expedientTipusId}/{definicioProcesId}/borrarRepro/{reproId}", method = RequestMethod.POST)
public String deleteRepro(
HttpServletRequest request,
@PathVariable Long expedientTipusId,
@PathVariable Long definicioProcesId,
@PathVariable Long reproId,
@ModelAttribute("command") Object command,
BindingResult result,
SessionStatus status,
Model model) {
try {
String nomRepro = reproService.deleteById(reproId);
MissatgesHelper.success(request, getMessage(request, "repro.missatge.repro") + " '" + nomRepro + "' " + getMessage(request, "repro.missatge.eliminat"));
} catch (Exception ex) {
MissatgesHelper.error(request, getMessage(request, "repro.missatge.error.eliminat"));
}
return expedientInicioPasFormController.iniciarFormGet(request, expedientTipusId, definicioProcesId, model);
}
示例13: jbpmFormPost
import org.springframework.web.bind.support.SessionStatus; //導入依賴的package包/類
@RequestMapping(value = "/carrec/jbpmForm", method = RequestMethod.POST)
public String jbpmFormPost(
HttpServletRequest request,
@RequestParam(value = "submit", required = false) String submit,
@ModelAttribute("command") CarrecJbpmId command,
BindingResult result,
SessionStatus status) {
if ("submit".equals(submit) || submit.length() == 0) {
annotationValidator.validate(command, result);
if (result.hasErrors())
return "/carrec/jbpmForm";
try {
if (command.getId() == null)
organitzacioService.createCarrecJbpmId(command);
else
organitzacioService.updateCarrecJbpmId(command);
missatgeInfo(request, getMessage("info.infocarrec.guardat") );
status.setComplete();
} catch (Exception ex) {
missatgeError(request, getMessage("error.proces.peticio"), ex.getLocalizedMessage());
logger.error("No s'ha pogut guardar la informació del càrrec", ex);
return "/carrec/jbpmForm";
}
}
return "redirect:/carrec/jbpmConfigurats.html";
}
示例14: formPost
import org.springframework.web.bind.support.SessionStatus; //導入依賴的package包/類
@RequestMapping(value = "form", method = RequestMethod.POST)
public String formPost(
HttpServletRequest request,
@RequestParam(value = "submit", required = false) String submit,
@ModelAttribute("command") Persona command,
BindingResult result,
SessionStatus status) {
if ("submit".equals(submit) || submit.length() == 0) {
if (validator != null)
validator.validate(command, result);
if (result.hasErrors()) {
return "perfil/form";
}
try {
personaService.updatePerfil(command);
missatgeInfo(request, getMessage("info.perfil.guardat") );
status.setComplete();
} catch (Exception ex) {
missatgeError(request, getMessage("error.guardar.perfil"), ex.getLocalizedMessage());
logger.error("No s'ha pogut guardar el registre", ex);
return "perfil/form";
}
return "redirect:/perfil/info.html";
}
return "redirect:/perfil/info.html";
}
示例15: onSubmit
import org.springframework.web.bind.support.SessionStatus; //導入依賴的package包/類
@RequestMapping(value="/submit")
protected String onSubmit(HttpServletRequest request,
SessionStatus status
) throws ServletRequestBindingException {
UserSession userSession = (UserSession) WebUtils.getSessionAttribute(request, "userSession");
PlayerData player = playerService.findPlayer(userSession.getGameId(), userSession.getMemberId());
QuestionData q = (QuestionData) WebUtils.getSessionAttribute(request, "qsess");
if (q == null) {
logger.error("No session in preview post!");
return "redirect:make";
}
logger.debug("================> qid="+q.getId());
request.getSession().removeAttribute("qsess");
playerService.submitQuestion(player.getId(), q);
return "redirect:/game/game";
}