Package ortus.boxlang.web.context
Class WebRequestBoxContext
java.lang.Object
ortus.boxlang.runtime.context.BaseBoxContext
ortus.boxlang.runtime.context.RequestBoxContext
ortus.boxlang.web.context.WebRequestBoxContext
- All Implemented Interfaces:
Serializable,ortus.boxlang.runtime.context.IBoxContext,ortus.boxlang.runtime.context.IJDBCCapableContext,ortus.boxlang.runtime.util.IBoxAttachable
public class WebRequestBoxContext
extends ortus.boxlang.runtime.context.RequestBoxContext
This context represents the context of a web/HTTP site in BoxLang
There a variables and request scope present.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface ortus.boxlang.runtime.context.IBoxContext
ortus.boxlang.runtime.context.IBoxContext.ScopeSearchResult -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ortus.boxlang.runtime.scopes.IScopeThe CGI scopeprotected ortus.boxlang.runtime.scopes.IScopeThe cookie scopeprotected ortus.boxlang.runtime.scopes.IScopeThe form scopeprotected IBoxHTTPExchangeprotected ObjectThe request body can only be read once, so we cache it hereprotected ortus.boxlang.runtime.scopes.IScopeThe request scopeprotected ortus.boxlang.runtime.scopes.IScopeThe URL scopeprotected ortus.boxlang.runtime.scopes.IScopeThe variables scopeprotected StringFields inherited from class ortus.boxlang.runtime.context.BaseBoxContext
buffers, components, currentImports, parent, queryLoops, templates -
Constructor Summary
ConstructorsConstructorDescriptionWebRequestBoxContext(ortus.boxlang.runtime.context.IBoxContext parent, IBoxHTTPExchange exchange, String webRoot) Creates a new execution context with a bounded execution template and parent contextWebRequestBoxContext(ortus.boxlang.runtime.context.IBoxContext parent, IBoxHTTPExchange httpExchange, String webRoot, URI template) Creates a new execution context with a bounded execution template and parent context -
Method Summary
Modifier and TypeMethodDescriptionortus.boxlang.runtime.context.IBoxContextflushBuffer(boolean force) Flush the buffer to the output streamortus.boxlang.runtime.types.IStructortus.boxlang.runtime.scopes.IScopeGet the default variable assignment scope for this contextGet the HTTP exchangeGet the request body as a byte arrayortus.boxlang.runtime.scopes.IScopegetScope(ortus.boxlang.runtime.scopes.Key name) Get a scope from the context.ortus.boxlang.runtime.scopes.IScopegetScopeNearby(ortus.boxlang.runtime.scopes.Key name, boolean shallow) Get a scope from the context.ortus.boxlang.runtime.scopes.KeyGet the session key for this requestortus.boxlang.runtime.types.IStructgetVisibleScopes(ortus.boxlang.runtime.types.IStruct scopes, boolean nearby, boolean shallow) Get the web root for this requestvoidregisterUDF(ortus.boxlang.runtime.types.UDF udf, boolean override) voidInvalidate a sessionortus.boxlang.runtime.context.IBoxContext.ScopeSearchResultscopeFind(ortus.boxlang.runtime.scopes.Key key, ortus.boxlang.runtime.scopes.IScope defaultScope) Try to get the requested key from the unscoped scope Meaning it needs to search scopes in order according to it's context.ortus.boxlang.runtime.context.IBoxContext.ScopeSearchResultscopeFindNearby(ortus.boxlang.runtime.scopes.Key key, ortus.boxlang.runtime.scopes.IScope defaultScope, boolean shallow) Try to get the requested key from the unscoped scope Meaning it needs to search scopes in order according to it's context.Methods inherited from class ortus.boxlang.runtime.context.RequestBoxContext
getApplicationListener, getConnectionManager, getLocale, getOut, getRequestClassLoader, getRequestStart, getRequestTimeout, getSettings, getThreadManager, getTimezone, isEnforceExplicitOutput, loadApplicationDescriptor, setApplicationListener, setEnforceExplicitOutput, setLocale, setOut, setRequestTimeout, setTimezone, shutdownConnectionsMethods inherited from class ortus.boxlang.runtime.context.BaseBoxContext
canOutput, clearBuffer, findBaseTemplate, findClosestComponent, findClosestComponent, findClosestFunctionName, findClosestTemplate, findFunction, getAttachment, getAttachmentKeys, getBuffer, getComponents, getConfigItem, getConfigItem, getConfigItems, getCurrentImports, getFunctionClass, getFunctionInterface, getFunctionParentContext, getModuleRecord, getModuleSettings, getParent, getParentOfType, getQueryRow, getRuntime, getScopeNearby, getTemplates, getVisibleScopes, hasAttachment, hasParent, hasTemplates, includeTemplate, incrementQueryLoop, injectParentContext, injectTopParentContext, invokeComponent, invokeFunction, invokeFunction, invokeFunction, invokeFunction, invokeFunction, invokeFunction, invokeFunction, invokeFunction, navigateConfig, popBuffer, popComponent, popTemplate, pushBuffer, pushComponent, 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.context.IBoxContext
startup
-
Field Details
-
variablesScope
protected ortus.boxlang.runtime.scopes.IScope variablesScopeThe variables scope -
requestScope
protected ortus.boxlang.runtime.scopes.IScope requestScopeThe request scope -
URLScope
protected ortus.boxlang.runtime.scopes.IScope URLScopeThe URL scope -
formScope
protected ortus.boxlang.runtime.scopes.IScope formScopeThe form scope -
CGIScope
protected ortus.boxlang.runtime.scopes.IScope CGIScopeThe CGI scope -
cookieScope
protected ortus.boxlang.runtime.scopes.IScope cookieScopeThe cookie scope -
httpExchange
-
requestBody
The request body can only be read once, so we cache it here -
webRoot
-
-
Constructor Details
-
WebRequestBoxContext
public WebRequestBoxContext(ortus.boxlang.runtime.context.IBoxContext parent, IBoxHTTPExchange httpExchange, String webRoot, URI template) Creates a new execution context with a bounded execution template and parent context- Parameters:
parent- The parent context
-
WebRequestBoxContext
public WebRequestBoxContext(ortus.boxlang.runtime.context.IBoxContext parent, IBoxHTTPExchange exchange, String webRoot) Creates a new execution context with a bounded execution template and parent context- Parameters:
parent- The parent context
-
-
Method Details
-
getSessionID
public ortus.boxlang.runtime.scopes.Key getSessionID()Get the session key for this request- Specified by:
getSessionIDin classortus.boxlang.runtime.context.RequestBoxContext- Returns:
- The session key
-
resetSession
public void resetSession()Invalidate a session- Specified by:
resetSessionin classortus.boxlang.runtime.context.RequestBoxContext
-
getVisibleScopes
public ortus.boxlang.runtime.types.IStruct getVisibleScopes(ortus.boxlang.runtime.types.IStruct scopes, boolean nearby, boolean shallow) - Specified by:
getVisibleScopesin interfaceortus.boxlang.runtime.context.IBoxContext- Overrides:
getVisibleScopesin classortus.boxlang.runtime.context.RequestBoxContext
-
scopeFindNearby
public ortus.boxlang.runtime.context.IBoxContext.ScopeSearchResult scopeFindNearby(ortus.boxlang.runtime.scopes.Key key, ortus.boxlang.runtime.scopes.IScope defaultScope, boolean shallow) 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 interfaceortus.boxlang.runtime.context.IBoxContext- Overrides:
scopeFindNearbyin classortus.boxlang.runtime.context.BaseBoxContext- Parameters:
key- The key to search for- Returns:
- The value of the key if found
-
scopeFind
public ortus.boxlang.runtime.context.IBoxContext.ScopeSearchResult scopeFind(ortus.boxlang.runtime.scopes.Key key, ortus.boxlang.runtime.scopes.IScope defaultScope) 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 interfaceortus.boxlang.runtime.context.IBoxContext- Overrides:
scopeFindin classortus.boxlang.runtime.context.RequestBoxContext- Parameters:
key- The key to search for- Returns:
- The value of the key if found
-
getScope
public ortus.boxlang.runtime.scopes.IScope getScope(ortus.boxlang.runtime.scopes.Key name) throws ortus.boxlang.runtime.types.exceptions.ScopeNotFoundException 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 interfaceortus.boxlang.runtime.context.IBoxContext- Overrides:
getScopein classortus.boxlang.runtime.context.BaseBoxContext- Returns:
- The requested scope
- Throws:
ortus.boxlang.runtime.types.exceptions.ScopeNotFoundException
-
getScopeNearby
public ortus.boxlang.runtime.scopes.IScope getScopeNearby(ortus.boxlang.runtime.scopes.Key name, boolean shallow) throws ortus.boxlang.runtime.types.exceptions.ScopeNotFoundException Get a scope from the context. If not found, the parent context is asked. Search all konwn scopes- Specified by:
getScopeNearbyin interfaceortus.boxlang.runtime.context.IBoxContext- Overrides:
getScopeNearbyin classortus.boxlang.runtime.context.BaseBoxContext- Returns:
- The requested scope
- Throws:
ortus.boxlang.runtime.types.exceptions.ScopeNotFoundException
-
registerUDF
public void registerUDF(ortus.boxlang.runtime.types.UDF udf, boolean override) - Specified by:
registerUDFin interfaceortus.boxlang.runtime.context.IBoxContext- Overrides:
registerUDFin classortus.boxlang.runtime.context.BaseBoxContext
-
getDefaultAssignmentScope
public ortus.boxlang.runtime.scopes.IScope getDefaultAssignmentScope()Get the default variable assignment scope for this context- Specified by:
getDefaultAssignmentScopein interfaceortus.boxlang.runtime.context.IBoxContext- Overrides:
getDefaultAssignmentScopein classortus.boxlang.runtime.context.BaseBoxContext- Returns:
- The scope reference to use
-
flushBuffer
public ortus.boxlang.runtime.context.IBoxContext flushBuffer(boolean force) Flush the buffer to the output stream- Specified by:
flushBufferin interfaceortus.boxlang.runtime.context.IBoxContext- Overrides:
flushBufferin classortus.boxlang.runtime.context.BaseBoxContext- Parameters:
force- true, flush even if output is disabled- Returns:
- This context
-
getHTTPExchange
Get the HTTP exchange- Returns:
- The HTTP exchange
-
getRequestBody
Get the request body as a byte array- Returns:
- The request body
-
getConfig
public ortus.boxlang.runtime.types.IStruct getConfig()- Specified by:
getConfigin interfaceortus.boxlang.runtime.context.IBoxContext- Overrides:
getConfigin classortus.boxlang.runtime.context.RequestBoxContext
-
getWebRoot
Get the web root for this request- Returns:
- The web root
-