Retrieves the current effective UIContext. Note that this method will return null if called from outside normal
request processing, for example during the intial application UI construction.

@return the current effective UIContext.
483776
public static UIContext getCurrent() {
		Stack<UIContext> stack = CONTEXT_STACK.get();

		if (stack == null || stack.isEmpty()) {
			return null;
		}

		return getStack().peek();
	}
1214103
public function get_context() {
        if ($this->coursecontext === null) {
            $this->coursecontext = \context_course::instance($this->course->id);
        }
        return $this->coursecontext;
    }
632140
protected function getContextObject()
    {
        if ($this->contextObject === null) {
            $this->contextObject = $this->loadContextObject();
        }

        return $this->contextObject;
    }
300033
@Override
    public String getContextRoot() {
        if (delegate == null) {
            return this.contextRoot;
        } else {
            return this.contextRoot == null ? delegate.getContextRoot() : this.contextRoot;
        }
    }
1253700
@Override
    public ServletContext getServletContext() {
        try {
            collaborator.preInvoke(componentMetaData);
            return request.getServletContext();
        } finally {
            collaborator.postInvoke();
        }
    }
771829
public static UIContext getContextForComponent(final WComponent component) {
		// Start with the current Context
		UIContext result = UIContextHolder.getCurrent();
		// Go through the contexts until we find the component
		while (result instanceof SubUIContext && !((SubUIContext) result).isInContext(component)) {
			result = ((SubUIContext) result).getBacking();
		}
		return result;
	}
866978
@Override
    public String getContextPath() {
        final HttpServletRequest request = getCurrentRequest();
        String appUri = (String) request.getAttribute(GrailsApplicationAttributes.APP_URI_ATTRIBUTE);
        if (appUri == null) {
            appUri = urlHelper.getContextPath(request);
        }
        return appUri;
    }
489617
public static UIContext getPrimaryUIContext(final UIContext uic) {
		if (uic == null) {
			return null;
		}

		UIContext primary = null;
		UIContext current = uic;

		while (primary == null) {
			if (current instanceof UIContextDelegate) {
				UIContext backing = ((UIContextDelegate) current).getBacking();
				if (backing != null) {
					current = backing;
				} else {
					// This case should probably never happen.
					primary = current;
					LOG.warn("UIContextDelegate found without a backing context");
				}
			} else {
				primary = current;
			}
		}

		return primary;
	}
801540
public String getOnText() {
		String value = (String) getStateHelper().eval(PropertyKeys.onText);
		return value;
	}
481435
private static <T> ThreadContext<T> getCurrentThreadContext(ThreadContext<T> threadContext)
    {
        return ((ThreadContextImpl<T>) threadContext).get();
    }
1229300
def get_context(self):
        
        ctx = self._obj.get_context()
        return _ContextProxy(ctx, self._factory)
273267
public static UIContext getContext(final String key, final Request request) {
		return (UIContext) request.getSessionAttribute(DATA_LIST_UIC_SESSION_KEY);
	}
250765
@javax.annotation.Nullable
  static Span getCurrentSpan() {
    SpanContext currentSpanContext = CURRENT_SPAN.get();
    return currentSpanContext != null ? currentSpanContext.span : null;
  }
797995
private ViewableContext getViewableContext() {
        final Set<ViewableContext> customProviders =
                Providers.getCustomProviders(injectionManager, ViewableContext.class);
        if (!customProviders.isEmpty()) {
            return customProviders.iterator().next();
        }
        return Providers.getProviders(injectionManager, ViewableContext.class).iterator().next();
    }
1218671
public function getContext()
    {
        if (isset($this->server['REQUEST_METHOD']) && isset($this->server['REQUEST_URI'])) {
            return $this->server['REQUEST_METHOD'].' '.strtok($this->server['REQUEST_URI'], '?');
        }
    }
148867
protected function getRequestContext()
    {
        if (null === $this->requestContext) {
            $this->requestContext = new RequestContext();
            $this->requestContext->fromRequest($this->getRequest());
        }

        return $this->requestContext;
    }
1331479
public static PageFlowContext getContext() {
        PageFlowContext ctxt = (PageFlowContext) pageflowContext.get();
        if (ctxt == null) {
            ctxt = new PageFlowContext();
            pageflowContext.set(ctxt);
        }
        return ctxt;
    }