src/main/java/js/servlet/SessionScopeFactory.java
private HttpSession getSession(InstanceKey instanceKey) {
		RequestContext requestContext = appFactory.getInstance(RequestContext.class);
		HttpServletRequest httpRequest = requestContext.getRequest();
		if (httpRequest == null) {
			throw new BugError("Invalid web context due to null HTTP request. Cannot create managed instance for |%s| with scope SESSION.", instanceKey);
		}

		// create HTTP session if missing; accordingly API httpSession is never null if 'create' flag is true
		return httpRequest.getSession(true);
	}
private HttpSession getSession(InstanceKey instanceKey) {
		RequestContext requestContext = appFactory.getInstance(RequestContext.class);
		HttpServletRequest httpRequest = requestContext.getRequest();
		if (httpRequest == null) {
			throw new BugError("Invalid web context due to null HTTP request. Cannot create managed instance for |%s| with scope SESSION.", instanceKey);
		}

		// create HTTP session if missing; accordingly API httpSession is never null if 'create' flag is true
		return httpRequest.getSession(true);
	}
Get HTTP session from current request, creating it if necessary. This method should be call inside a request context
otherwise bug error is thrown.

@param instanceKey managed instance key.
@return current request HTTP session.
@throws BugError if attempt to use this method outside a HTTP request.