List of usage examples for javax.servlet.http HttpSession setAttribute
public void setAttribute(String name, Object value);
From source file:com.github.rollercage.CageCommentAuthenticator.java
@Override public String getHtml(javax.servlet.http.HttpServletRequest req) { String token = cage.getTokenGenerator().next(); HttpSession session = req.getSession(true); session.setAttribute(TOKEN, token); StringBuilder result = new StringBuilder(); result.append("<p>Please solve the puzzle: </p>"); result.append("<p>"); result.append("<img alt=\"CAPTCHA\" src=\"data:image/jpeg;base64,"); result.append(Base64.encodeBase64String(cage.draw(token))); result.append("\"/>"); result.append(" <input name=\"" + ANSWER + "\"/>"); result.append("</p>"); return result.toString(); }
From source file:com.tsg.cms.HomeController.java
@RequestMapping(value = "/tinymce", method = RequestMethod.GET) public String showEditor(Map<String, Object> model, HttpSession session) { session.setAttribute("page", "tinymce"); session.setAttribute("js_page", "tinymce.js"); return "home"; }
From source file:com.MyHistory.Controller.UsuarioController.java
@RequestMapping(value = "/login", method = RequestMethod.POST) public ModelAndView abrirSesion(HttpServletRequest pRequest) { System.out.println("Pasando por LoginController method:post"); String nombre_usuario = pRequest.getParameter("Nombre Usuario"); String password = pRequest.getParameter("Password"); ModelAndView model = new ModelAndView(); ResponseLogin response = _LoginService.loguear(nombre_usuario, password); if (!response.resultadoExitoso()) { model.setViewName("login"); model.addObject("response", response); return model; }//from ww w. ja v a 2s . c om HttpSession sesion = pRequest.getSession(); sesion.setAttribute("Usuario", response.getVistaUsuario()); model.setViewName("redirect:/home.htm"); return model; }
From source file:com.orchestra.portale.controller.ExternalAuthController.java
@RequestMapping(value = "/fbLoginJs", produces = "application/json") public @ResponseBody String fbLoginJs(HttpServletRequest request, HttpServletResponse response) { User user = FbAuthenticationManager.fbLoginJs(request, response, userRepository); Authentication auth = new FbAuthentication(user); SecurityContext securityContext = SecurityContextHolder.getContext(); securityContext.setAuthentication(auth); // Create a new session and add the security context. HttpSession session = request.getSession(true); session.setAttribute("SPRING_SECURITY_CONTEXT", securityContext); //Get access_token from request String access_token = request.getParameter("access_token"); System.out.println("ACCESS TOKEN: " + access_token); if (access_token != null) { fbProfiler.setAccess_token(access_token); fbProfiler.newUser();//w w w . ja v a 2s. c o m } return "{\"login\":\"ok\"}"; }
From source file:com.tsg.cms.HomeController.java
@RequestMapping(value = "/blog", method = RequestMethod.GET) public String showBlog(Map<String, Object> model, HttpSession session) { session.setAttribute("page", "blog"); session.setAttribute("js_page", "blog.js"); return "home"; }
From source file:com.tsg.cms.HomeController.java
@RequestMapping(value = "/articles", method = RequestMethod.GET) public String showArticles(Map<String, Object> model, HttpSession session) { session.setAttribute("page", "articles"); session.setAttribute("js_page", "articles.js"); return "home"; }
From source file:com.tsg.cms.HomeController.java
@RequestMapping(value = "/login", method = RequestMethod.GET) public String showLoginPage(Map<String, Object> model, HttpSession session) { session.setAttribute("page", "login"); session.setAttribute("js_page", "login.js"); return "home"; }
From source file:org.openmrs.web.controller.concept.ConceptStopWordFormController.java
@ModelAttribute("command") public ConceptStopWord formBackingObject(HttpSession httpSession) throws Exception { httpSession.setAttribute("locales", LocaleUtility.getLocalesInOrder()); return new ConceptStopWord(); }
From source file:springku.BelajarController.java
@RequestMapping(value = "/formlogin", method = RequestMethod.POST) public ModelAndView formloginPost(@ModelAttribute("login") Hallo h, HttpServletRequest request, HttpServletResponse response) {/*from w w w.j av a 2 s. co m*/ if (h.getNama().equals("admin") && h.getNim().equals("admin")) { Map<String, String> m = new HashMap<>(); HttpSession hs = request.getSession(); hs.setAttribute("username", h.getNama()); return new ModelAndView("redirect:simpan"); } else { ModelAndView modelAndView = new ModelAndView("form"); modelAndView.addObject("command", new Hallo()); request.setAttribute("error", "username dan password masih salah"); return modelAndView; } }
From source file:com.tsg.cms.HomeController.java
@RequestMapping(value = "/tinymce/{id}", method = RequestMethod.GET) public String showPopulatedEditor(@PathVariable("id") int id, Map<String, Object> model, HttpSession session) { session.setAttribute("page", "tinymce"); session.setAttribute("js_page", "tinymce.js"); model.put("editBlogPostId", id); return "home"; }