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

    Fields
    Modifier and Type
    Field
    Description
    protected ortus.boxlang.runtime.scopes.IScope
    The CGI scope
    protected ortus.boxlang.runtime.scopes.IScope
    The cookie scope
    protected ortus.boxlang.runtime.scopes.IScope
    The form scope
     
    protected Object
    The request body can only be read once, so we cache it here
    protected ortus.boxlang.runtime.scopes.IScope
    The request scope
    protected ortus.boxlang.runtime.scopes.IScope
    The URL scope
    protected ortus.boxlang.runtime.scopes.IScope
    The variables scope
    protected String
     

    Fields inherited from class ortus.boxlang.runtime.context.BaseBoxContext

    buffers, components, currentImports, parent, queryLoops, templates
  • Constructor Summary

    Constructors
    Constructor
    Description
    WebRequestBoxContext(ortus.boxlang.runtime.context.IBoxContext parent, IBoxHTTPExchange exchange, String webRoot)
    Creates a new execution context with a bounded execution template and parent context
    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
  • Method Summary

    Modifier and Type
    Method
    Description
    ortus.boxlang.runtime.context.IBoxContext
    flushBuffer(boolean force)
    Flush the buffer to the output stream
    ortus.boxlang.runtime.types.IStruct
     
    ortus.boxlang.runtime.scopes.IScope
    Get the default variable assignment scope for this context
    Get the HTTP exchange
    Get the request body as a byte array
    ortus.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 request
    ortus.boxlang.runtime.types.IStruct
    getVisibleScopes(ortus.boxlang.runtime.types.IStruct scopes, boolean nearby, boolean shallow)
     
    Get the web root for this request
    void
    registerUDF(ortus.boxlang.runtime.types.UDF udf, boolean override)
     
    void
    Invalidate a session
    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.
    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 variablesScope
      The variables scope
    • requestScope

      protected ortus.boxlang.runtime.scopes.IScope requestScope
      The request scope
    • URLScope

      protected ortus.boxlang.runtime.scopes.IScope URLScope
      The URL scope
    • formScope

      protected ortus.boxlang.runtime.scopes.IScope formScope
      The form scope
    • CGIScope

      protected ortus.boxlang.runtime.scopes.IScope CGIScope
      The CGI scope
    • cookieScope

      protected ortus.boxlang.runtime.scopes.IScope cookieScope
      The cookie scope
    • httpExchange

      protected IBoxHTTPExchange httpExchange
    • requestBody

      protected Object requestBody
      The request body can only be read once, so we cache it here
    • webRoot

      protected String 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 class ortus.boxlang.runtime.context.RequestBoxContext
      Returns:
      The session key
    • resetSession

      public void resetSession()
      Invalidate a session
      Specified by:
      resetSession in class ortus.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 interface ortus.boxlang.runtime.context.IBoxContext
      Overrides:
      getVisibleScopes in class ortus.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 interface ortus.boxlang.runtime.context.IBoxContext
      Overrides:
      scopeFindNearby in class ortus.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 interface ortus.boxlang.runtime.context.IBoxContext
      Overrides:
      scopeFind in class ortus.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 interface ortus.boxlang.runtime.context.IBoxContext
      Overrides:
      getScope in class ortus.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 interface ortus.boxlang.runtime.context.IBoxContext
      Overrides:
      getScopeNearby in class ortus.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 interface ortus.boxlang.runtime.context.IBoxContext
      Overrides:
      registerUDF in class ortus.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 interface ortus.boxlang.runtime.context.IBoxContext
      Overrides:
      getDefaultAssignmentScope in class ortus.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 interface ortus.boxlang.runtime.context.IBoxContext
      Overrides:
      flushBuffer in class ortus.boxlang.runtime.context.BaseBoxContext
      Parameters:
      force - true, flush even if output is disabled
      Returns:
      This context
    • getHTTPExchange

      public IBoxHTTPExchange getHTTPExchange()
      Get the HTTP exchange
      Returns:
      The HTTP exchange
    • getRequestBody

      public Object 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 interface ortus.boxlang.runtime.context.IBoxContext
      Overrides:
      getConfig in class ortus.boxlang.runtime.context.RequestBoxContext
    • getWebRoot

      public String getWebRoot()
      Get the web root for this request
      Returns:
      The web root