coldbox.system.web.services

Class InterceptorService

lucee.Component
    extended by coldbox.system.web.services.BaseService
      extended by coldbox.system.web.services.InterceptorService

Copyright Since 2005 ColdBox Framework by Luis Majano and Ortus Solutions, Corp www.ortussolutions.com --- This service takes care of all events and interceptions in ColdBox

Class Attributes:
  • synchronized : false
  •  
  • accessors : true
  •  
  • persistent : false
  •  
    Property Summary
    type property default serializable required
    array interceptionPoints
          Interception Points which can be announced.

    • access = public
    • returntype = any
    true false
    struct interceptionStates
          Interception States that represent the unique points.

    • access = public
    • returntype = any
    true false
    struct interceptorConfig
          Interceptor Service Configuration.

    • access = public
    • returntype = any
    true false
    Constructor Summary
    init(any controller)
          Constructor.
    Method Summary
    array appendInterceptionPoints(any customPoints)
         Append a list of custom interception points to the CORE interception points and returns itself.
    InterceptorService configure()
         Configure the service.
    any createInterceptor(any interceptorClass, any interceptorName, [struct interceptorProperties='[runtime expression]'])
         Create a new interceptor object with ColdBox pizzaz.
    string getInterceptionPoints()
    string getInterceptionStates()
    any getInterceptor(any interceptorName)
         Retrieve an interceptor from the system by name, if not found, this method will throw an exception.
    string getInterceptorConfig()
    struct getLazyBuffer()
         Produce a lazy buffer for performance considerations.
    any getStateContainer(any state)
         Get a State Container, it will return a blank structure if the state is not found.
    private struct newPointRecord()
         Create a new interception point record.
    any onConfigurationLoad()
         Run once config loads.
    private struct parseMetadata(any metadata, any points)
         I get a components valid interception points.
    any processState(any state, [any interceptData='[runtime expression]'], [boolean async='false'], [boolean asyncAll='false'], [boolean asyncAllJoin='true'], [string asyncPriority='NORMAL'], [numeric asyncJoinTimeout='0'])
         Process a State's Interceptors.
    any registerInterceptionPoint(any interceptorKey, any state, any oInterceptor, [any interceptorMD])
         Register an Interception point into a new or created interception state.
    any registerInterceptor([any interceptorClass], [any interceptorObject], [struct interceptorProperties='[runtime expression]'], [any customPoints=''], [any interceptorName])
         Register a new interceptor in ColdBox.
    any registerInterceptors()
         Registers all the interceptors configured.
    any setInterceptionPoints(array interceptionPoints)
    any setInterceptionStates(struct interceptionStates)
    any setInterceptorConfig(struct interceptorConfig)
    boolean unregister(any interceptorName, [any state=''])
         Unregister an interceptor from an interception state or all states.
    private InterceptorService wireboxSetup()
         Verifies the setup for interceptor classes is online.
     
    Methods inherited from class coldbox.system.web.services.BaseService
    getController, onShutdown, setController
     
    Methods inherited from class lucee.Component
    None

    Constructor Detail

    init

    public init(any controller)

    Constructor

    Parameters:
    controller

    Property Detail

    interceptionPoints

    property array interceptionPoints

    Interception Points which can be announced

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    interceptionStates

    property struct interceptionStates

    Interception States that represent the unique points

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    interceptorConfig

    property struct interceptorConfig

    Interceptor Service Configuration

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    Method Detail

    appendInterceptionPoints

    public array appendInterceptionPoints(any customPoints)

    Append a list of custom interception points to the CORE interception points and returns itself

    Parameters:
    customPoints - A comma delimmited list or array of custom interception points to append. If they already exists, then they will not be added again.
    Returns:
    The current interception points

    configure

    public InterceptorService configure()

    Configure the service


    createInterceptor

    public any createInterceptor(any interceptorClass, any interceptorName, [struct interceptorProperties='[runtime expression]'])

    Create a new interceptor object with ColdBox pizzaz

    Parameters:
    interceptorClass - The class path to instantiate
    interceptorName - The unique name of the object
    interceptorProperties - Construction properties
    Returns:
    The newly created interceptor

    getInterceptionPoints

    public string getInterceptionPoints()


    getInterceptionStates

    public string getInterceptionStates()


    getInterceptor

    public any getInterceptor(any interceptorName)

    Retrieve an interceptor from the system by name, if not found, this method will throw an exception

    Parameters:
    interceptorName - The name to retrieve

    getInterceptorConfig

    public string getInterceptorConfig()


    getLazyBuffer

    public struct getLazyBuffer()

    Produce a lazy buffer for performance considerations

    Returns:
    { get(), clear(), append(), length(), getString() }

    getStateContainer

    public any getStateContainer(any state)

    Get a State Container, it will return a blank structure if the state is not found.

    Parameters:
    state - The state to retrieve

    newPointRecord

    private struct newPointRecord()

    Create a new interception point record


    onConfigurationLoad

    public any onConfigurationLoad()

    Run once config loads

    Overrides:
    onConfigurationLoad in class BaseService
    Returns:
    InterceptorService

    parseMetadata

    private struct parseMetadata(any metadata, any points)

    I get a components valid interception points

    Parameters:
    metadata
    points

    processState

    public any processState(any state, [any interceptData='[runtime expression]'], [boolean async='false'], [boolean asyncAll='false'], [boolean asyncAllJoin='true'], [string asyncPriority='NORMAL'], [numeric asyncJoinTimeout='0'])

    Process a State's Interceptors Announce an interception to the system. If you use the asynchronous facilities, you will get a thread structure report as a result. This is needed so interceptors can write to the page output buffer

    Parameters:
    state - An interception state to process
    interceptData - A data structure used to pass intercepted information.
    async - If true, the entire interception chain will be ran in a separate thread.
    asyncAll - If true, each interceptor in the interception chain will be ran in a separate thread and then joined together at the end.
    asyncAllJoin - If true, each interceptor in the interception chain will be ran in a separate thread and joined together at the end by default. If you set this flag to false then there will be no joining and waiting for the threads to finalize.
    asyncPriority - The thread priority to be used. Either LOW, NORMAL or HIGH. The default value is NORMAL
    asyncJoinTimeout - The timeout in milliseconds for the join thread to wait for interceptor threads to finish. By default there is no timeout

    registerInterceptionPoint

    public any registerInterceptionPoint(any interceptorKey, any state, any oInterceptor, [any interceptorMD])

    Register an Interception point into a new or created interception state

    Parameters:
    interceptorKey - The interceptor key to use for lookups in the state
    state - The state to create
    oInterceptor - The interceptor to register
    interceptorMD - The metadata about the interception point: {async, asyncPriority, eventPattern}

    registerInterceptor

    public any registerInterceptor([any interceptorClass], [any interceptorObject], [struct interceptorProperties='[runtime expression]'], [any customPoints=''], [any interceptorName])

    Register a new interceptor in ColdBox

    Parameters:
    interceptorClass - Mutex with interceptorObject, this is the qualified class of the interceptor to register
    interceptorObject - Mutex with interceptor Class, this is used to register an already instantiated object as an interceptor
    interceptorProperties - The structure of properties to register this interceptor with.
    customPoints - A comma delimmited list or array of custom interception points, if the object or class sent in observes them.
    interceptorName - The name to use for the interceptor when stored. If not used, we will use the name found in the object's class
    Returns:
    InterceptorService

    registerInterceptors

    public any registerInterceptors()

    Registers all the interceptors configured

    Returns:
    InterceptorService

    setInterceptionPoints

    public any setInterceptionPoints(array interceptionPoints)

    Parameters:
    interceptionPoints

    setInterceptionStates

    public any setInterceptionStates(struct interceptionStates)

    Parameters:
    interceptionStates

    setInterceptorConfig

    public any setInterceptorConfig(struct interceptorConfig)

    Parameters:
    interceptorConfig

    unregister

    public boolean unregister(any interceptorName, [any state=''])

    Unregister an interceptor from an interception state or all states. If the state does not exists, it returns false

    Parameters:
    interceptorName - The interceptor to unregister
    state - The state to unregister from, if not, passed, then from all states

    wireboxSetup

    private InterceptorService wireboxSetup()

    Verifies the setup for interceptor classes is online