List of usage examples for javax.servlet.http HttpServletRequest getSession
public HttpSession getSession();
From source file:com.bitranger.parknshop.buyer.controller.ShowCartController.java
@RequestMapping(value = "/cart") public String showCart(HttpServletRequest req) { PsCustomer currentCustomer = (PsCustomer) req.getSession().getAttribute("currentCustomer"); if (currentCustomer == null) return Utility.error("Not Login"); FetchOption option = new FetchOption(); option.offset = 0;/*from w w w . jav a 2 s . co m*/ option.limit = 10000; option.sortOption = SortOption.DESCENDING; List<CartCustomerItem> cartCustomerItems = psCartCustomerItemDao.findByCustomerId(currentCustomer.getId(), option); req.setAttribute("cartCustomerItems", cartCustomerItems); return "cartView"; }
From source file:uk.ac.liverpool.online.asamoah.dissertation.fingerprinting.controller.VisitorController.java
@RequestMapping(value = "/visitor/devices", method = RequestMethod.POST) public @ResponseBody Object getUserDevices(HttpServletRequest request) { User user = (User) request.getSession().getAttribute("user"); if (user == null) return null; return deviceSvc.getUserDevices(user.getId()); }
From source file:com.hillert.botanic.controller.UploadController.java
@RequestMapping(method = RequestMethod.GET) public String provideUploadInfo(@PathVariable("plantId") Long plantId, HttpServletRequest request) { LOGGER.info(request.getSession().getId()); return String.format("You can upload a file for plant with id '%s' by posting to this same URL.", plantId); }
From source file:uk.ac.liverpool.online.asamoah.dissertation.fingerprinting.controller.VisitorController.java
@RequestMapping(value = "/visitor/sessions", method = RequestMethod.POST) public @ResponseBody Object getUserSessions(@RequestParam("page") int page, @RequestParam("size") int size, HttpServletRequest request) { User user = (User) request.getSession().getAttribute("user"); if (user == null) return null; return sessionSvc.getUserSessions(user.getId(), page, size); }
From source file:com.horas.web.CommentController.java
/** * * @param comment/*from w w w.j a v a 2 s. c om*/ * @return */ @RequestMapping(value = "/addcomments", method = RequestMethod.POST) @ResponseBody public ResponseMessage addCommentNews(@RequestBody Comment comment, HttpServletRequest request) { String username; HttpSession sess = request.getSession(); username = (String) sess.getAttribute("username"); comment.setIdComment(sys_guid()); // comment.setIdNews(sys_guid()); comment.setUserComment(username); comment.setIpComment("127.0.0.2"); comment.setDateComment(new Date()); commentService.addCommentNews(comment); return new ResponseMessage(ResponseMessage.Type.success, "commentAdded"); }
From source file:com.suntek.gztpb.controller.ChangeCarControll.java
@RequestMapping(value = "validateCode.htm", method = RequestMethod.POST) public @ResponseBody String validateCode(HttpServletRequest request) throws Exception { String certCode = request.getSession().getAttribute("certCode").toString(); String code = request.getParameter("code"); if (code.equalsIgnoreCase(certCode)) { return "true"; }/*from w ww . j a va2s . c om*/ return "false"; }
From source file:com.application.model.dao.AuthenticationService.java
public void handleLogout(HttpServletRequest httpRequest) { ServletContext servletContext = httpRequest.getSession().getServletContext(); WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext); LogoutHandler logoutHandler = wac.getBean(LogoutHandler.class); Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); // Response should not be used? logoutHandler.logout(httpRequest, null, authentication); }
From source file:com.naver.timetable.bo.LoginBO.java
public void logout(HttpServletRequest request) { HttpSession session = request.getSession(); if (session.getAttribute("user") != null) { session.removeAttribute("user"); }// ww w . ja v a2s. c o m }
From source file:springku.BelajarController.java
@RequestMapping("/keluar") public String keluar(HttpServletRequest request) { HttpSession httpSession = request.getSession(); if (httpSession.getAttribute("username") != null) { httpSession.invalidate();/*from w w w.ja v a2 s . c o m*/ ; } return "redirect:formlogin"; }
From source file:gov.nih.nci.cabig.caaers.web.admin.DeviceController.java
@Override protected Object formBackingObject(HttpServletRequest request) throws Exception { request.getSession().removeAttribute(getReplacedCommandSessionAttributeName(request)); request.getSession().removeAttribute(DeviceEditController.class.getName() + ".FORM.command"); request.getSession().removeAttribute(DeviceCreateController.class.getName() + ".FORM.command"); return null;/*ww w.ja va 2 s . com*/ }