List of usage examples for javax.servlet.http HttpServletRequest getSession
public HttpSession getSession(boolean create);
From source file:fr.paris.lutece.plugins.mylutece.web.MyLuteceApp.java
/** * Set the current url/* ww w . j a v a 2s . co m*/ * @param request The Http request * */ public static void setCurrentUrl(HttpServletRequest request) { String strCurrentUrl = request.getRequestURI(); UrlItem url = new UrlItem(strCurrentUrl); Enumeration enumParams = request.getParameterNames(); while (enumParams.hasMoreElements()) { String strParamName = (String) enumParams.nextElement(); url.addParameter(strParamName, request.getParameter(strParamName)); } HttpSession session = request.getSession(true); session.setAttribute(ATTRIBUTE_CURRENT_URL, url.getUrl()); }
From source file:fr.paris.lutece.portal.service.util.AppPathService.java
/** * Return the url of the webapp, built from the request * * @param request The HttpServletRequest * @return strBase the webapp url/*from w w w . j a va 2s . c om*/ */ public static String getBaseUrl(HttpServletRequest request) { if (request == null) { return getBaseUrl(); } String strBase; // Search for a Virtual Host Base Url defined in the request strBase = getVirtualHostBaseUrl(request); // If not found, get the base url from session if ((strBase == null) || strBase.equals(StringUtils.EMPTY)) { HttpSession session = request.getSession(false); if (session != null) { Object oBase = session.getAttribute(SESSION_BASE_URL); if (oBase != null) { strBase = (String) oBase; } } } // If not found, get the base url from the config.properties if ((strBase == null) || (strBase.equals(StringUtils.EMPTY))) { strBase = AppPropertiesService.getProperty(PROPERTY_BASE_URL); } if ((strBase == null) || (strBase.equals(StringUtils.EMPTY))) { // Dynamic base URL if not defined in the properties strBase = request.getScheme() + DOUBLE_POINTS + SLASH + SLASH + request.getServerName(); int nPort = request.getServerPort(); if (nPort != PORT_NUMBER_HTTP) { strBase += (DOUBLE_POINTS + nPort); } strBase += request.getContextPath(); } if (!strBase.endsWith(SLASH)) { strBase += SLASH; } return strBase; }
From source file:company.gonapps.loghut.controller.LogoutController.java
@RequestMapping(value = "/logout.do", method = RequestMethod.GET) public String logout(HttpServletRequest request) throws Exception { request.getSession(false).invalidate(); return "redirect:" + request.getScheme() + "://" + request.getServerName() + getSettingDao().getSetting("admin.url") + "/login_form.do"; }
From source file:test.IndexController.java
@RequestMapping(method = RequestMethod.GET, path = "/logout") public String sair(HttpServletRequest arg0) { arg0.getSession(true).invalidate(); SecurityContextHolder.clearContext(); System.out.println("saindo"); return "sair"; }
From source file:edu.mum.waa.webstore.controller.CartController.java
@RequestMapping public String get(HttpServletRequest request) { return "redirect:/cart/" + request.getSession(true).getId(); }
From source file:com.mum.controller.CardController.java
@RequestMapping public String get(HttpServletRequest request) { System.out.println("Load here:: " + request.getSession(true).getId()); return "redirect:/card/" + request.getSession(true).getId(); }
From source file:org.jasig.portlet.survey.security.UportalPreAuthenticatedProcessingFilter.java
@Override protected Object getPreAuthenticatedPrincipal(HttpServletRequest request) { HttpSession session = request.getSession(false); if (session == null) { return null; }//from www. ja va 2 s . c om final UserDetails details = (UserDetails) session .getAttribute(UPortalSecurityFilter.AUTHENTICATION_TOKEN_KEY); return details; }
From source file:company.gonapps.loghut.controller.LoginFormController.java
@RequestMapping(value = "/login_form.do", method = RequestMethod.GET) public String loginForm(HttpServletRequest request) throws Exception { HttpSession session = request.getSession(false); if (session == null) { return "admin/login_form"; }//w w w . j av a2s . c om return "redirect:" + request.getScheme() + "://" + request.getServerName() + getSettingDao().getSetting("admin.url") + "/index.do"; }
From source file:com.havoc.hotel.controller.HomeController.java
@RequestMapping(method = RequestMethod.GET, value = "logout") public String Logout(HttpServletRequest req, HttpServletResponse resp) { HttpSession session = req.getSession(false); String checking = (String) session.getAttribute("username"); if (checking == null) { return "redirect:/?logout=false"; } else {/*from www. j a v a 2s . c o m*/ session.invalidate(); return "redirect:/"; } }
From source file:demo.SessionMDCFilter.java
private void configureMDC(HttpServletRequest request) { HttpSession session = request.getSession(false); if (session == null) { return;/*from www . j a v a 2 s . co m*/ } String config = (String) session.getAttribute(MDC_KEY); if (config == null) { return; } MDC.put(MDC_KEY, config); }