Utility to check session values set by query params (such as preview mode)
@param req
@param queryParam
@param sessionKey
@returns {*|boolean}
962321
function sessionValueSwitch(req, queryParam, sessionKey) {
    if(req.query[queryParam]) {
        if(req.user && req.user.role !== 'guest' && typeify(req.query[queryParam]) === true) {
            req.session[sessionKey] = true;
        } else if(typeify(req.query[queryParam]) === false) {
            req.session[sessionKey] = false;
        }
    }
    return req.session ? req.session[sessionKey] : false;
}
849043
private static org.hibernate.engine.spi.EntityKey getOptionalObjectKey(QueryParameters queryParameters, SharedSessionContractImplementor session) {
		final Object optionalObject = queryParameters.getOptionalObject();
		final Serializable optionalId = queryParameters.getOptionalId();
		final String optionalEntityName = queryParameters.getOptionalEntityName();

		if ( optionalObject != null && optionalEntityName != null ) {
			return session.generateEntityKey( optionalId, session.getEntityPersister( optionalEntityName, optionalObject ) );
		}
		else {
			return null;
		}
	}
912760
function validateQueryParams() {
        var queryString;
        if (config.queryParams) {
            if (typeof config.queryParams === 'string') {
                // strip '?' if it's there, because we add it below
                queryString = config.queryParams.replace(/^\?/, '');
            } else {
                queryString = util.param(config.queryParams);
            }
        }
        config.queryString = queryString ? '?' + queryString : '';
    }
477008
public static ProcessRetrieveResponse checkRequestParameter(
			HttpServletRequest request, ServletContext context) {
		ProcessRetrieveResponse response = new ProcessRetrieveResponse(context);
		Integer numItems = checkNumItems(request, response);
		String term = checkTerm(request, response);
		if (term == null) {
			return response;
		}
		SuggestTree index = checkIndexName(request, response, context);
		if (index == null) {
			response.addError(RetrieveStatusCodes.NO_INDEX_AVAILABLE);
			return response;
		}
		retrieveSuggestions(request, response, index, term, numItems);
		return response;
	}
977475
def ensure_session_key(request):
    
    key = request.session.session_key
    if key is None:
        # @@@ Django forces us to handle session key collision amongst
        # multiple processes (not handled)
        request.session.save()
        # force session to persist for client
        request.session.modified = True
        key = request.session.session_key
    return key
1038985
function(key, defaultValue){
            if($ExpressSESSION.session.store[key]){
                return $ExpressSESSION.session.store[key];
            }
            if(defaultValue) return defaultValue;
            else throw new Error('index '+key+' not exists in session');
        }
561659
@RequestMapping(params = {"query", "queryId"})
    public ModelAndView showSearchResults(
            PortletRequest request,
            @RequestParam(value = "query") String query,
            @RequestParam(value = "queryId") String queryId) {

        final Map<String, Object> model = new HashMap<>();
        model.put("query", query);

        // Determine if the new REST search should be used
        if (isRestSearch(request)) {
            // we only need query, so the model at this point is sufficient
            return new ModelAndView("/jsp/Search/searchRest", model);
        }

        ConcurrentMap<String, List<Tuple<SearchResult, String>>> results =
                new ConcurrentHashMap<>();
        final PortalSearchResults portalSearchResults =
                this.getPortalSearchResults(request, queryId);
        if (portalSearchResults != null) {
            results = portalSearchResults.getResults();
        }

        results.forEach(
                (key, value) -> {
                    value.sort(Comparator.comparingInt(tuple -> tuple.first.getRank()));
                });

        logger.debug("Search results for query '{}' are:  {}", query, results);

        model.put("results", results);
        model.put("defaultTabKey", this.defaultTabKey);
        model.put("tabKeys", this.tabKeys);

        final boolean isMobile = isMobile(request);
        String viewName = isMobile ? "/jsp/Search/mobileSearch" : "/jsp/Search/search";

        return new ModelAndView(viewName, model);
    }
775411
@NotNull
    @Override
    public ExternalSetQueryContext<E, ?> queryContext(E key) {
        //noinspection unchecked
        return (ExternalSetQueryContext<E, ?>) m.queryContext(key);
    }
387847
private Object findByKey(String key) {
		Object value = Config.get(request, key);
		if (value != null) {
			return value;
		}

		value = Config.get(request.getSession(createNewSession()), key);
		if (value != null) {
			return value;
		}

		value = Config.get(request.getServletContext(), key);
		if (value != null) {
			return value;
		}

		return request.getServletContext().getInitParameter(key);
	}
183555
protected void prepareQuery(org.hibernate.query.Query query) {
        if (cacheQueries) {
            query.setCacheable(true);
        }
        if (shouldPassReadOnlyToHibernate()) {
            query.setReadOnly(true);
        }
        SessionHolder sessionHolder = (SessionHolder) TransactionSynchronizationManager.getResource(sessionFactory);
        if (sessionHolder != null && sessionHolder.hasTimeout()) {
            query.setTimeout(sessionHolder.getTimeToLiveInSeconds());
        }
    }
1056916
public CmsUgcSession getSession(HttpServletRequest request, CmsUUID sessionId) {

        return (CmsUgcSession)request.getSession(true).getAttribute("" + sessionId);
    }
542430
public static String getParameterValueFromQuery(String query, String paramName) {
        String[] components = query.split("&");

        for (String keyValuePair : components) {
            String[] pairComponents = keyValuePair.split("=");

            if (pairComponents.length == 2) {
                try {
                    String key = URLDecoder.decode(pairComponents[0], "utf-8");
                    if (key.compareTo(paramName) == 0) {
                        return URLDecoder.decode(pairComponents[1], "utf-8");
                    }
                } catch (UnsupportedEncodingException e) {
                    logger.error("getParameterValueFromQuery failed with exception: " + e.getLocalizedMessage(), e);
                }

            }
        }

        return null;
    }
640515
public GetSessionResponse getSession(GetSessionRequest request) {
        checkNotNull(request, "The parameter request should NOT be null.");
        checkStringNotEmpty(request.getSessionId(), "The parameter sessionId should NOT be null or empty string.");
        InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, LIVE_SESSION,
                request.getSessionId());
        return invokeHttpClient(internalRequest, GetSessionResponse.class);
    }
878678
def do_get_session(self, session_key):
        
        session_id = session_key.session_id
        msg = ("do_get_session: Attempting to retrieve session with key " +
               str(session_id))
        logger.debug(msg)

        session = self._retrieve_session(session_key)

        if (session is not None):
            self.validate(session, session_key)

        return session
150247
public static <T> AttributeKey<T> sessionScoped() {
        return new AttributeKey<T>() {
            public T get(HttpServletRequest req) {
                HttpSession s = req.getSession(false);
                if (s==null)    return null;
                return (T)s.getAttribute(name);
            }

            public void set(HttpServletRequest req, T value) {
                req.getSession().setAttribute(name, value);
            }

            public void remove(HttpServletRequest req) {
                HttpSession s = req.getSession(false);
                if (s!=null)
                    s.removeAttribute(name);
            }
        };
    }
233217
public GetSessionStatisticsResponse getSessionStatistics(GetSessionStatisticsRequest request) {
        checkNotNull(request, "The parameter request should NOT be null.");
        checkStringNotEmpty(request.getSessionId(), "The parameter sessionId should NOT be null or empty string.");
        InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, STATISTICS, LIVE_SESSION,
                request.getSessionId());
        if (request.getStartDate() != null) {
            internalRequest.addParameter("startDate", request.getStartDate());
        }
        if (request.getEndDate() != null) {
            internalRequest.addParameter("endDate", request.getEndDate());
        }
        if (request.getAggregate() != null) {
            internalRequest.addParameter("aggregate", request.getAggregate().toString());
        }
        return invokeHttpClient(internalRequest, GetSessionStatisticsResponse.class);
    }
777533
function(params, req) {
    if (req.query._jsonpdata) {
      var jsonpdata = null;
      try {
        jsonpdata = JSON.parse(decodeURIComponent(req.query._jsonpdata));
        params = _.extend(params, jsonpdata);
      } catch (e) {
        params._jsonpdata = req.query._jsonpdata;
      }
    }
    return params;
  }