List of usage examples for javax.servlet.http HttpServletRequest getSession
public HttpSession getSession();
From source file:edu.cornell.mannlib.vitro.webapp.auth.policy.ServletPolicyList.java
/** * Get a copy of the current list of policies. This method may return an * empty list, but it never returns null. *///from www . ja va2s. c om public static PolicyIface getPolicies(HttpServletRequest hreq) { return getPolicies(hreq.getSession().getServletContext()); }
From source file:mojo.view.util.DebugUtils.java
public static void logRequestInfo(HttpServletRequest req) { logger.debug("session.id : " + req.getSession().getId()); logger.debug("request.method : " + req.getMethod()); logger.debug("request.pathInfo : " + req.getPathInfo()); logger.debug("request.requestURI : " + req.getRequestURI()); logger.debug("request.requestURL : " + req.getRequestURL()); logger.debug("request.queryString : " + req.getQueryString()); logger.debug(""); logRequestHeaders(req);/* ww w .j av a 2s . co m*/ logRequestParameters(req); logRequestAttributes(req); }
From source file:com.squarecash4glass.util.OAuth2Util.java
public static String getUserId(HttpServletRequest request) { HttpSession session = request.getSession(); return (String) session.getAttribute("userId"); }
From source file:eionet.gdem.web.struts.qascript.QAScriptListLoader.java
public static void loadPermissions(HttpServletRequest httpServletRequest) { String user_name = (String) httpServletRequest.getSession().getAttribute("user"); try {/*from w w w . j a va 2 s . com*/ httpServletRequest.getSession().setAttribute(QASCRIPT_PERMISSIONS_ATTR, loadQAScriptPermissions(user_name)); } catch (Exception e) { e.printStackTrace(); LOGGER.error("Error getting QA script permissions", e); } }
From source file:org.openmrs.module.logmanager.web.util.WebUtils.java
/** * Sets the OpenMRS info message value which is displayed at the top of the page * @param request the request object/*from w w w . java 2s .c o m*/ * @param msgs the message source * @param code the message code */ public static void setInfoMessage(HttpServletRequest request, String code, Object[] args) { String msg = ContextProvider.getMessage(code, args); request.getSession().setAttribute(WebConstants.OPENMRS_MSG_ATTR, msg); }
From source file:org.openmrs.module.logmanager.web.util.WebUtils.java
/** * Sets the OpenMRS error message value which is displayed at the top of the page * @param request the request object/*from ww w. ja v a 2 s . com*/ * @param msgs the message source * @param code the message code */ public static void setErrorMessage(HttpServletRequest request, String code, Object[] args) { String msg = ContextProvider.getMessage(code, args); request.getSession().setAttribute(WebConstants.OPENMRS_ERROR_ATTR, msg); }
From source file:com.pureinfo.tgirls.utils.servlet.CookieUtils.java
public static User getLoginUser(HttpServletRequest _request, HttpServletResponse _response) { User loginUser = (User) _request.getSession().getAttribute(ArkHelper.ATTR_LOGIN_USER); if (loginUser != null) { logger.debug("get user from session." + loginUser.getTaobaoID()); return loginUser; }/*w ww .j a va2s .com*/ logger.debug("user not in session."); String taobaoId = getCookieValue(_request.getCookies(), TAOBAO_ID); if (StringUtils.isEmpty(taobaoId)) { return null; } try { IUserMgr mgr = (IUserMgr) ArkContentHelper.getContentMgrOf(User.class); loginUser = mgr.getUserByTaobaoId(taobaoId); _request.getSession().setAttribute(ArkHelper.ATTR_LOGIN_USER, loginUser); return loginUser; } catch (PureException e) { // TODO Auto-generated catch block e.printStackTrace(System.err); } return null; }
From source file:com.controlj.green.modstat.servlets.LongRunning.java
public static Object getWork(HttpServletRequest req) { return req.getSession().getAttribute(ATTRIB_WORK); }
From source file:org.freeeed.search.web.session.SessionContext.java
public static SolrSessionObject getSolrSession() { HttpServletRequest curRequest = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()) .getRequest();//ww w.j a v a 2s. co m HttpSession session = curRequest.getSession(); SolrSessionObject solrSession = (SolrSessionObject) session .getAttribute(WebConstants.WEB_SESSION_SOLR_OBJECT); return solrSession; }
From source file:org.tsm.concharto.auth.AuthHelper.java
@SuppressWarnings("unchecked") public static void clearCredentials(HttpServletRequest request, HttpServletResponse response) { //clear out the session Enumeration attrNames = request.getSession().getAttributeNames(); while (attrNames.hasMoreElements()) { String name = (String) attrNames.nextElement(); WebUtils.setSessionAttribute(request, name, null); //free all session data request.getSession().invalidate(); }// w w w . j av a 2s. com //clear the remember me cookies AuthHelper.setCookie(response, AuthHelper.COOKIE_REMEMBER_ME, 0, ""); AuthHelper.setCookie(response, AuthHelper.COOKIE_REMEMBER_ME_USERNAME, 0, ""); }