Builds and returns a list of http sessions that correspond to a given context.

@param context the context
@return the http sessions for context
358363
public List<HttpSession> getHttpSessionsForContext(Context context) {
		List<HttpSession> sessions = new LinkedList<>();
		if (this.sessions == null) {
			return sessions;
		}

		synchronized (sessionLock) {
			for (Entry<String, HttpSessionsSite> e : this.sessions.entrySet()) {
				String siteName = e.getKey();
				siteName = "http://" + siteName;
				if (context.isInContext(siteName))
					sessions.addAll(e.getValue().getHttpSessions());
			}
		}

		return sessions;
	}
773673
@NonNull public static Activity getActivity(@NonNull Context context) {
    if (context == null) {
      throw new NullPointerException("context == null");
    }
    if (context instanceof Activity) {
      return (Activity) context;
    }

    while (context instanceof ContextWrapper) {
      if (context instanceof Activity) {
        return (Activity) context;
      }
      context = ((ContextWrapper) context).getBaseContext();
    }
    throw new IllegalStateException("Could not find the surrounding Activity");
  }
1363523
public EventBuilder withContexts(Map<String, Map<String, Object>> contexts) {
        event.setContexts(contexts);
        return this;
    }
1292966
public static KFSession kfsessionGetsessionlist(String access_token, String kf_account) {
		HttpUriRequest httpUriRequest = RequestBuilder.get()
					.setHeader(jsonHeader)
					.setUri(BASE_URI + "/customservice/kfsession/getsessionlist")
					.addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token))
					.addParameter("kf_account", kf_account)
					.build();
		return LocalHttpClient.executeJsonResult(httpUriRequest, KFSession.class);
	}
1076140
public List<CmsAccessControlEntry> getAllAccessControlEntries(CmsRequestContext context) throws CmsException {

        CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
        List<CmsAccessControlEntry> result = null;
        try {
            result = m_driverManager.getAllAccessControlEntries(dbc);
        } catch (Exception e) {
            dbc.report(null, Messages.get().container(Messages.ERR_GET_ACL_ENTRIES_1, "<all resources>"), e);
        } finally {
            dbc.clear();
        }
        return result;

    }
770536
public static String getHttpServletRequestUserAgentFromRequestContext(final RequestContext context) {
        val request = getHttpServletRequestFromExternalWebflowContext(context);
        return getHttpServletRequestUserAgentFromRequestContext(request);
    }
456047
public HttpSession getHttpSession(String name) {
		synchronized (this.sessions) {
			for (HttpSession session : sessions) {
				if (session.getName().equals(name)) {
					return session;
				}
			}
		}
		return null;
	}
613323
@SuppressWarnings(value="unchecked")
	public Iterator<?> getSessions() {
		if(!isValid()) {
			throw new IllegalStateException("SipApplicationSession already invalidated !");
		}
		Set<MobicentsSipSession> sipSessions = getSipSessions(false);
		Set<HttpSession> httpSessions = getHttpSessions();
		Set protocolSessions = new HashSet();
		protocolSessions.addAll(httpSessions);
		protocolSessions.addAll(sipSessions);
		return protocolSessions.iterator();
	}
764303
protected IHttpSessionContext createSessionContextObject(SessionManagerConfig smc, SessionApplicationParameters sap)
    {
        return new HttpSessionContext31Impl(smc, sap, this.smgr.getSessionStoreService());
    }
528536
public synchronized HttpContext getHttpContext() {
        if (jolokiaHttpContext == null) {
            final String user = getConfiguration(USER);
            final String authMode = getConfiguration(AUTH_MODE);
            if (user == null) {
                if (ServiceAuthenticationHttpContext.shouldBeUsed(authMode)) {
                    jolokiaHttpContext = new ServiceAuthenticationHttpContext(bundleContext, authMode);
                } else {
                    jolokiaHttpContext = new DefaultHttpContext();
                }
            } else {
                jolokiaHttpContext =
                    new BasicAuthenticationHttpContext(getConfiguration(REALM),
                                                       createAuthenticator(authMode));
            }
        }
        return jolokiaHttpContext;
    }
381205
def session(context, data):
    
    context.http.reset()

    user = context.get('user')
    password = context.get('password')

    if user is not None and password is not None:
        context.http.session.auth = (user, password)

    user_agent = context.get('user_agent')
    if user_agent is not None:
        context.http.session.headers['User-Agent'] = user_agent

    referer = context.get('url')
    if referer is not None:
        context.http.session.headers['Referer'] = referer

    proxy = context.get('proxy')
    if proxy is not None:
        proxies = {'http': proxy, 'https': proxy}
        context.http.session.proxies = proxies

    # Explictly save the session because no actual HTTP requests were made.
    context.http.save()
    context.emit(data=data)
1313913
@Override
	public synchronized List<RecordContext> getDataForContext (int contextId) throws DatabaseException {
    	try {
			List<RecordContext> result = new ArrayList<>();
			psGetAllDataForContext.setInt(1, contextId);
			try (ResultSet rs = psGetAllDataForContext.executeQuery()) {
				while (rs.next()) {
					result.add(new RecordContext(rs.getLong(DATAID), rs.getInt(CONTEXTID), rs.getInt(TYPE), rs.getString(DATA)));
				}
			}
			
			return result;
		} catch (SQLException e) {
			throw new DatabaseException(e);
		}
    }
189753
private Cookie[] constructCookies(final TestContext context) {
        final List<Cookie> cookies = cookieEnricher.enrich(template.getCookies(), context);
        return cookies.toArray(new Cookie[0]);
    }
101120
@Override
    public String getSessionCookieName() {
        String result = getSessionCookieNameFromContext((Context) getContainer());
        if ( result == null ) {
            result = Globals.SESSION_COOKIE_NAME;
            _log.debug( "Using session cookie name from context: " + result );
        }
        return result;
    }
214230
@SuppressWarnings("unchecked")
	public IHttpSessionContext getSessionContext(com.ibm.ws.container.DeployedModule moduleConfig, WebApp webApp, ArrayList[] listeners) throws Throwable
	{
		//System.out.println("WebGroup createSC");
		return ((VirtualHost) parent).getSessionContext(moduleConfig, webApp, listeners);
	}
463805
public Set<IoSession> find(Iterable<IoSession> sessions) throws OgnlException {
        if (sessions == null) {
            throw new NullPointerException("sessions");
        }
        
        Set<IoSession> answer = new LinkedHashSet<>();
        for (IoSession s: sessions) {
            OgnlContext context = (OgnlContext) Ognl.createDefaultContext(s);
            context.setTypeConverter(typeConverter);
            context.put(AbstractPropertyAccessor.READ_ONLY_MODE, true);
            context.put(AbstractPropertyAccessor.QUERY, query);
            Object result = Ognl.getValue(expression, context, s);
            if (result instanceof Boolean) {
                if ((Boolean) result) {
                    answer.add(s);
                }
            } else {
                throw new OgnlException(
                        "Query didn't return a boolean value: " + query);
            }
        }
        
        return answer;
    }
572105
public static Activity scanForActivity(Context context) {
        if (context == null) return null;

        if (context instanceof Activity) {
            return (Activity) context;
        } else if (context instanceof ContextWrapper) {
            return scanForActivity(((ContextWrapper) context).getBaseContext());
        }

        return null;
    }