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.IScope
The CGI scopeprotected ortus.boxlang.runtime.scopes.IScope
The cookie scopeprotected ortus.boxlang.runtime.scopes.IScope
The form scopeprotected IBoxHTTPExchange
protected Object
The request body can only be read once, so we cache it hereprotected ortus.boxlang.runtime.scopes.IScope
The request scopeprotected ortus.boxlang.runtime.scopes.IScope
The URL scopeprotected ortus.boxlang.runtime.scopes.IScope
The variables scopeprotected String
Fields 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.IBoxContext
flushBuffer
(boolean force) Flush the buffer to the output streamortus.boxlang.runtime.types.IStruct
ortus.boxlang.runtime.scopes.IScope
Get the default variable assignment scope for this contextGet the HTTP exchangeGet the request body as a byte arrayortus.boxlang.runtime.scopes.IScope
getScope
(ortus.boxlang.runtime.scopes.Key name) Get a scope from the context.ortus.boxlang.runtime.scopes.IScope
getScopeNearby
(ortus.boxlang.runtime.scopes.Key name, boolean shallow) Get a scope from the context.ortus.boxlang.runtime.scopes.Key
Get the session key for this requestortus.boxlang.runtime.types.IStruct
getVisibleScopes
(ortus.boxlang.runtime.types.IStruct scopes, boolean nearby, boolean shallow) Get the web root for this requestvoid
registerUDF
(ortus.boxlang.runtime.types.UDF udf, boolean override) void
Invalidate a sessionortus.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.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.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, shutdownConnections
Methods 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, writeToBuffer
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:
getSessionID
in classortus.boxlang.runtime.context.RequestBoxContext
- Returns:
- The session key
-
resetSession
public void resetSession()Invalidate a session- Specified by:
resetSession
in 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:
getVisibleScopes
in interfaceortus.boxlang.runtime.context.IBoxContext
- Overrides:
getVisibleScopes
in 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:
scopeFindNearby
in interfaceortus.boxlang.runtime.context.IBoxContext
- Overrides:
scopeFindNearby
in 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:
scopeFind
in interfaceortus.boxlang.runtime.context.IBoxContext
- Overrides:
scopeFind
in 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:
getScope
in interfaceortus.boxlang.runtime.context.IBoxContext
- Overrides:
getScope
in 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:
getScopeNearby
in interfaceortus.boxlang.runtime.context.IBoxContext
- Overrides:
getScopeNearby
in 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:
registerUDF
in interfaceortus.boxlang.runtime.context.IBoxContext
- Overrides:
registerUDF
in classortus.boxlang.runtime.context.BaseBoxContext
-
getDefaultAssignmentScope
public ortus.boxlang.runtime.scopes.IScope getDefaultAssignmentScope()Get the default variable assignment scope for this context- Specified by:
getDefaultAssignmentScope
in interfaceortus.boxlang.runtime.context.IBoxContext
- Overrides:
getDefaultAssignmentScope
in 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:
flushBuffer
in interfaceortus.boxlang.runtime.context.IBoxContext
- Overrides:
flushBuffer
in 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:
getConfig
in interfaceortus.boxlang.runtime.context.IBoxContext
- Overrides:
getConfig
in classortus.boxlang.runtime.context.RequestBoxContext
-
getWebRoot
Get the web root for this request- Returns:
- The web root
-