當前位置: 首頁>>代碼示例>>Java>>正文


Java SessionStatus類代碼示例

本文整理匯總了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";
	}
}
 
開發者ID:Illusionist80,項目名稱:SpringTutorial,代碼行數:17,代碼來源:AccountsController.java

示例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;
}
 
開發者ID:mintster,項目名稱:nixmash-blog,代碼行數:17,代碼來源:FileUploadController.java

示例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;
    }
}
 
開發者ID:mintster,項目名稱:nixmash-blog,代碼行數:24,代碼來源:FileUploadController.java

示例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";
    }
}
 
開發者ID:mintster,項目名稱:nixmash-blog,代碼行數:20,代碼來源:AdminController.java

示例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";
    }
}
 
開發者ID:mintster,項目名稱:nixmash-blog,代碼行數:18,代碼來源:AdminPostsController.java

示例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";
    }
}
 
開發者ID:mintster,項目名稱:nixmash-blog,代碼行數:18,代碼來源:AdminPostsController.java

示例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;
}
 
開發者ID:puncha,項目名稱:petclinic,代碼行數:23,代碼來源:PetController.java

示例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";
    }
}
 
開發者ID:le4ndro,項目名稱:SpringBootFreemarkerDemo,代碼行數:20,代碼來源:ContatoController.java

示例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";
}
 
開發者ID:MTUHIDE,項目名稱:CoCoTemp,代碼行數:35,代碼來源:NewSiteController.java

示例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");
}
 
開發者ID:GovernIB,項目名稱:helium,代碼行數:20,代碼來源:TascaTramitacioController.java

示例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);
}
 
開發者ID:GovernIB,項目名稱:helium,代碼行數:26,代碼來源:ExpedientTokenV3Controller.java

示例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);
}
 
開發者ID:GovernIB,項目名稱:helium,代碼行數:19,代碼來源:ReproController.java

示例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";
}
 
開發者ID:GovernIB,項目名稱:helium,代碼行數:27,代碼來源:CarrecJbpmIdController.java

示例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";
}
 
開發者ID:GovernIB,項目名稱:helium,代碼行數:27,代碼來源:PerfilController.java

示例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";
}
 
開發者ID:kenfrank,項目名稱:trivolous,代碼行數:17,代碼來源:GameQueueController.java


注:本文中的org.springframework.web.bind.support.SessionStatus類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。