当前位置: 首页>>代码示例>>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;未经允许,请勿转载。