List of usage examples for javax.servlet.http HttpServletRequest getSession
public HttpSession getSession();
From source file:sample.web.HomeController.java
@RequestMapping("/setValue") public String setValue(@RequestParam(name = "key", required = false) String key, @RequestParam(name = "value", required = false) String value, HttpServletRequest request) { if (!ObjectUtils.isEmpty(key) && !ObjectUtils.isEmpty(value)) { request.getSession().setAttribute(key, value); }//from ww w . j a va 2s.com return "home"; }
From source file:com.liferay.portal.upload.LiferayFileUpload.java
public LiferayFileUpload(FileItemFactory fileItemFactory, HttpServletRequest request) { super(fileItemFactory); _session = request.getSession(); }
From source file:edu.cornell.mannlib.oce.filters.FakeLoginFilter.java
private void acceptLoginInfo(HttpServletRequest req) { req.getSession().setAttribute(ATTRIBUTE_LOGIN_ID, req.getParameter(PARAMETER_LOGIN_ID)); }
From source file:net.jforum.api.JForumExecutionContext.java
public JForumExecutionContext(HttpServletRequest request) { this.request = request; this.context = (ApplicationContext) request.getSession().getServletContext() .getAttribute(ConfigKeys.SPRING_CONTEXT); this.initialized = this.context != null; }
From source file:per.mnn.controller.CartController.java
private ShoppingCart checkCart(HttpServletRequest request) { HttpSession httpSess = request.getSession(); ShoppingCart cart = (ShoppingCart) httpSess.getAttribute("cart"); if (cart == null) { cart = new ShoppingCart(); httpSess.setAttribute("cart", cart); }//from w w w .j a v a 2s .co m return cart; }
From source file:de.hybris.eventtracking.ws.services.DefaultRawEventEnricher.java
/** * @see de.hybris.eventtracking.ws.services.RawEventEnricher#enrich(java.lang.String, * javax.servlet.http.HttpServletRequest) *//*w ww .jav a 2 s . co m*/ @Override public String enrich(final String json, final HttpServletRequest req) { final HttpSession session = req.getSession(); final String sessionId = session.getId(); final String timestamp = Integer.toString(Math.round(System.currentTimeMillis() / 1000)); // seconds since Unix epoch final UserModel user = userService.getCurrentUser(); String userId = null; String userEmail = null; if (user != null && CustomerModel.class.isAssignableFrom(user.getClass())) { userId = ((CustomerModel) user).getCustomerID(); userEmail = ((CustomerModel) user).getContactEmail(); } userId = StringUtils.trimToEmpty(userId); userEmail = StringUtils.trimToEmpty(userEmail); final Chainr chainr = Chainr.fromSpec(JsonUtils .jsonToList(String.format(ENRICHMENT_SPEC_TEMPLATE, sessionId, timestamp, userId, userEmail))); Map<String, Object> jsonObjectMap; try { jsonObjectMap = JsonUtils.javason(json); } catch (final IOException e) { throw new RuntimeException(e); } return JsonUtils.toJsonString(chainr.transform(jsonObjectMap)); }
From source file:com.liferay.portal.util.PortalUtil.java
public static Locale getLocale(HttpServletRequest req) { return (Locale) req.getSession().getAttribute(Globals.LOCALE_KEY); }
From source file:com.liferay.portal.util.PortalUtil.java
public static String getUserPassword(HttpServletRequest req) { return (String) req.getSession().getAttribute(WebKeys.USER_PASSWORD); }
From source file:de.micromata.genome.gwiki.model.mpt.GWikiSessionMptIdSelector.java
public String getTenantId(GWikiServlet servlet, HttpServletRequest req) { String id = (String) req.getSession().getAttribute(MPT_KEY); return id;// ww w. ja v a 2 s . com }
From source file:com.salesmanager.core.security.JAASCustomerSecurityFilter.java
@Override String getUser(HttpServletRequest request) { return (request.getSession() != null ? ((String) request.getSession().getAttribute(SecurityConstants.SM_CUSTOMER_USER)) : null);/*from w w w . j ava 2s . c o m*/ }