Package ortus.boxlang.runtime.context
Class ScriptingRequestBoxContext
java.lang.Object
ortus.boxlang.runtime.context.BaseBoxContext
ortus.boxlang.runtime.context.RequestBoxContext
ortus.boxlang.runtime.context.ScriptingRequestBoxContext
- All Implemented Interfaces:
Serializable,IBoxContext,IJDBCCapableContext,IBoxAttachable
- Direct Known Subclasses:
JSRScriptingRequestBoxContext
This context represents the context of a scripting execution in BoxLang
There a variables and request scope present.
The request scope may or may not belong here, but we're sort of using the scripting
context as the top level context for an execution request right now, so it make the
most sense here currently.
There may or may NOT be a template defined.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface ortus.boxlang.runtime.context.IBoxContext
IBoxContext.ScopeSearchResult -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected IScopeThe request scopeprotected IScopeThe variables scopeFields inherited from class ortus.boxlang.runtime.context.BaseBoxContext
buffers, components, currentImports, nullIsUndefined, parent, queryLoops, templates -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new execution contextScriptingRequestBoxContext(URI template) Creates a new execution context with a templateCreates a new execution context with a parent contextScriptingRequestBoxContext(IBoxContext parent, URI template) Creates a new execution context with a parent context, and templateScriptingRequestBoxContext(IBoxContext parent, BaseApplicationListener listener) Creates a new execution context with a parent context and a specific application listener. -
Method Summary
Modifier and TypeMethodDescriptionflushBuffer(boolean force) Flush the buffer to the output streamGet the default variable assignment scope for this contextGet a scope from the context.getScopeNearby(Key name, boolean shallow) Get a scope from the context.Get the session ID for this requestgetVisibleScopes(IStruct scopes, boolean nearby, boolean shallow) Get the visible scopes for this contextbooleanisKeyVisibleScope(Key key, boolean nearby, boolean shallow) Check if a key is visible in the current context as a scope name.voidregisterUDF(UDF udf, boolean override) Register a UDF with the local context choosing to override.voidInvalidate a sessionTry to get the requested key from the unscoped scope Meaning it needs to search scopes in order according to it's context.scopeFindNearby(Key key, IScope defaultScope, boolean shallow, boolean forAssign) Try to get the requested key from the unscoped scope Meaning it needs to search scopes in order according to it's context.voidsetSessionID(Key sessionID) The session ID can be set externallyMethods inherited from class ortus.boxlang.runtime.context.RequestBoxContext
clearConfigCache, getApplicationListener, getConfig, getConnectionManager, getCurrent, getLocale, getOut, getRequestClassLoader, getRequestStart, getRequestTimeout, getSettings, getThreadManager, getTimezone, isEnforceExplicitOutput, isShowDebugOutput, loadApplicationDescriptor, removeCurrent, runInContext, runInContext, setApplicationListener, setCurrent, setEnforceExplicitOutput, setLocale, setOut, setRequestTimeout, setShowDebugOutput, setTimezone, shutdown, shutdownConnectionsMethods inherited from class ortus.boxlang.runtime.context.BaseBoxContext
canOutput, clearBuffer, computeAttachmentIfAbsent, findBaseTemplate, findBIF, findClosestComponent, findClosestComponent, findClosestComponent, findClosestComponent, findClosestFunctionName, findClosestTemplate, findFunction, getApplicationContext, getAttachment, getAttachmentKeys, getBuffer, getComponents, getConfigItem, getConfigItem, getConfigItems, getCurrentImports, getFunctionClass, getFunctionInterface, getFunctionParentContext, getFunctionStaticClass, getLogger, getModuleRecord, getModuleSettings, getParent, getParentOfType, getQueryRow, getQueryRow, getRequestContext, getRuntime, getScopeNearby, getTemplates, getVisibleScopes, hasAttachment, hasParent, hasTemplates, includeTemplate, incrementQueryLoop, injectParentContext, injectTopParentContext, invokeComponent, invokeFunction, invokeFunction, invokeFunction, invokeFunction, invokeFunction, invokeFunction, invokeFunction, invokeFunction, isDefined, isInOutputComponent, isKeyVisibleScope, navigateConfig, popBuffer, popComponent, popTemplate, pushBuffer, pushComponent, pushTemplate, pushTemplate, putAttachment, queryFindNearby, registerQueryLoop, registerUDF, removeAttachment, removeParentContext, rethrow, scopeFindNearby, setParent, unregisterQueryLoop, unwrapQueryColumn, writeToBuffer, writeToBufferMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ortus.boxlang.runtime.util.IBoxAttachable
computeAttachmentIfAbsent, getAttachment, getAttachmentKeys, hasAttachment, putAttachment, removeAttachmentMethods inherited from interface ortus.boxlang.runtime.context.IBoxContext
canOutput, clearBuffer, findBaseTemplate, findClosestComponent, findClosestComponent, findClosestComponent, findClosestComponent, findClosestFunctionName, findClosestTemplate, getApplicationCache, getApplicationContext, getApplicationName, getBuffer, getComponents, getConfigItem, getConfigItem, getConfigItems, getCurrentImports, getFunctionClass, getFunctionInterface, getFunctionParentContext, getFunctionStaticClass, getModuleRecord, getModuleSettings, getParent, getParentOfType, getQueryRow, getQueryRow, getRequestContext, getRuntime, getScopeNearby, getTemplates, getVisibleScopes, hasParent, hasTemplates, includeTemplate, includeTemplate, incrementQueryLoop, injectParentContext, injectTopParentContext, invokeComponent, invokeFunction, invokeFunction, invokeFunction, invokeFunction, invokeFunction, invokeFunction, isDefined, isInOutputComponent, isKeyVisibleScope, navigateConfig, popBuffer, popComponent, popTemplate, pushBuffer, pushComponent, pushTemplate, pushTemplate, registerQueryLoop, registerUDF, registerUDF, removeParentContext, rethrow, scopeFindNearby, setParent, startup, unregisterQueryLoop, unwrapQueryColumn, writeToBuffer, writeToBuffer
-
Field Details
-
variablesScope
The variables scope -
requestScope
The request scope
-
-
Constructor Details
-
ScriptingRequestBoxContext
Creates a new execution context with a parent context- Parameters:
parent- The parent context
-
ScriptingRequestBoxContext
Creates a new execution context with a parent context and a specific application listener.- Parameters:
parent- The parent contextlistener- The application listener
-
ScriptingRequestBoxContext
Creates a new execution context with a parent context, and template- Parameters:
parent- The parent context
-
ScriptingRequestBoxContext
Creates a new execution context with a template- Parameters:
template- The template to use
-
ScriptingRequestBoxContext
public ScriptingRequestBoxContext()Creates a new execution context
-
-
Method Details
-
getSessionID
Get the session ID for this request- Specified by:
getSessionIDin classRequestBoxContext- Returns:
- The session ID
-
resetSession
public void resetSession()Invalidate a session- Specified by:
resetSessionin classRequestBoxContext
-
setSessionID
The session ID can be set externally- Parameters:
sessionID- The session ID
-
getVisibleScopes
Get the visible scopes for this context- Specified by:
getVisibleScopesin interfaceIBoxContext- Overrides:
getVisibleScopesin classRequestBoxContext- Parameters:
scopes- The scopes to add tonearby- If nearby scopes should be includedshallow- If only the top level scopes should be included- Returns:
- The scopes
-
isKeyVisibleScope
Check if a key is visible in the current context as a scope name. This allows us to "reserve" known scope names to ensure arguments.foo will always look in the proper arguments scope and never in local.arguments.foo for example- Specified by:
isKeyVisibleScopein interfaceIBoxContext- Overrides:
isKeyVisibleScopein classRequestBoxContext- Parameters:
key- The key to check for visibilitynearby- true, check only scopes that are nearby to the current execution contextshallow- true, do not delegate to parent or default scope if not found- Returns:
- True if the key is visible in the current context, else false
-
scopeFindNearby
public IBoxContext.ScopeSearchResult scopeFindNearby(Key key, IScope defaultScope, boolean shallow, boolean forAssign) Try to get the requested key from the unscoped scope Meaning it needs to search scopes in order according to it's context. A local lookup is used for the closest context to the executing code- Specified by:
scopeFindNearbyin interfaceIBoxContext- Overrides:
scopeFindNearbyin classBaseBoxContext- Parameters:
key- The key to search fordefaultScope- The default scope to return if the key is not foundshallow- true, do not delegate to parent or default scope if not foundforAssign- true, this is for an assignment operation- Returns:
- The value of the key if found
-
scopeFind
Try to get the requested key from the unscoped scope Meaning it needs to search scopes in order according to it's context. Unlike scopeFindNearby(), this version only searches trancedent scopes like cgi or server which are never encapsulated like variables is inside a class.- Specified by:
scopeFindin interfaceIBoxContext- Overrides:
scopeFindin classRequestBoxContext- Parameters:
key- The key to search fordefaultScope- The default scope to return if the key is not foundforAssign- true, this is for an assignment operation- Returns:
- The value of the key if found
-
getScope
Get a scope from the context. If not found, the parent context is asked. Don't search for scopes which are local to an execution context- Specified by:
getScopein interfaceIBoxContext- Overrides:
getScopein classBaseBoxContext- Parameters:
name- The name of the scope to get- Returns:
- The requested scope
- Throws:
ScopeNotFoundException- If the scope was not found in any context
-
getScopeNearby
Get a scope from the context. If not found, the parent context is asked. Search all konwn scopes- Specified by:
getScopeNearbyin interfaceIBoxContext- Overrides:
getScopeNearbyin classBaseBoxContext- Parameters:
name- The name of the scope to getshallow- true, do not delegate to parent or default scope if not found- Returns:
- The requested scope
- Throws:
ScopeNotFoundException- If the scope was not found in any context
-
registerUDF
Description copied from class:BaseBoxContextRegister a UDF with the local context choosing to override.- Specified by:
registerUDFin interfaceIBoxContext- Overrides:
registerUDFin classBaseBoxContext- Parameters:
udf- The UDF to registeroverride- true, override any existing UDF with the same name
-
getDefaultAssignmentScope
Get the default variable assignment scope for this context- Specified by:
getDefaultAssignmentScopein interfaceIBoxContext- Overrides:
getDefaultAssignmentScopein classBaseBoxContext- Returns:
- The scope reference to use
-
flushBuffer
Flush the buffer to the output stream- Specified by:
flushBufferin interfaceIBoxContext- Overrides:
flushBufferin classBaseBoxContext- Parameters:
force- true, flush even if output is disabled- Returns:
- This context
-