coldbox.system.interceptors

Class SES

railo-context.Component
        extended by coldbox.system.FrameworkSupertype
            extended by coldbox.system.Interceptor
                extended by coldbox.system.interceptors.SES
Class Attributes:
  • output : false
  •  
  • synchronized : false
  •  
  • accessors : false
  •  
  • persistent : false
  •  

    This interceptor provides complete SES and URL mappings support to ColdBox Applications

    Method Summary
    any addModuleRoutes(string pattern, string module, [boolean append='true'])
         Register modules routes in the specified position in the main routing table, and returns itself.
    any addNamespace(string pattern, string namespace, [boolean append='true'])
         Register a namespace in the specified position in the main routing table, and returns itself.
    any addRoute(string pattern, [string handler], [any action], [boolean packageResolverExempt='false'], [string matchVariables], [string view], [boolean viewNoLayout='false'], [boolean valuePairTranslation='true'], [any constraints=''], [string module=''], [string moduleRouting=''], [string namespace=''], [string namespaceRouting=''], [boolean ssl='false'], [boolean append='true'], [any response], [numeric statusCode], [string statusText], [any condition])
         Adds a route to dispatch and returns itself.
    private void checkForInvalidURL(any route, any script_name, any event)
         Check for invalid URL's.
    void configure()
         This is where the ses service configures itself.
    private any detectExtension(any requestString, any event)
         Detect extensions from the incoming request.
    any endWith()
         End a with closure and returns itself.
    private void findConventionNameValuePairs(string requestString, any match, struct params)
         Find the convention name value pairs.
    private any findRoute(any action, any event, [any module=''], [any namespace=''])
         Figures out which route matches this request and returns a routed structure.
    private any fixIISURLVars(any requestString, any rc)
         Clean up some IIS funkyness.
    any<boolean> getAutoReload()
         Set to auto reload the rules in each request.
    string getBaseURL()
         Get BaseURL.
    private any getCGIElement(any cgielement, any Event)
         The cgi element facade method.
    private any getCleanedPaths(any rc, any event)
         Get and Clean the path_info and script names structure.
    any<boolean> getEnabled()
         Get enabled.
    any<boolean> getExtensionDetection()
         Get the flag if extension detection is enabled.
    any<boolean> getLooseMatching()
         Get the current loose matching property.
    any<array> getModuleRoutes(any module='')
         Get a modules routes array.
    any<struct> getModulesRoutingTable()
         Get the entire modules routing table.
    any<array> getNamespaceRoutes(any namespace)
         Get a namespace routes array.
    any<struct> getNamespaceRoutingTable()
         Get the entire namespace routing table.
    any<array> getRoutes()
         Get the array containing all the routes.
    any<boolean> getThrowOnInvalidExtension()
         Get if we are throwing or not on invalid extension detection.
    any<boolean> getUniqueURLs()
         Get uniqueURLs.
    private any<Util> getUtil()
         Create and return a util object.
    any getValidExtensions()
         Get the list of valid extensions this interceptor allows.
    private void importConfiguration()
         Import the routing configuration file.
    any includeRoutes(any location)
         Includes a routes configuration file as an added import and returns itself after import.
    void onRequestCapture(any event, any interceptData)
         This is the route dispatch.
    private any packageResolver(any routingString, any routeParams, [any module=''])
         Resolve handler/module packages.
    private void processRouteOptionals(struct thisRoute)
         Process route optionals.
    private any processWith(any args)
         Process a with closure.
    any removeModuleRoutes(any module)
         Remove a module's routing table and registration points and return itself.
    any removeNamespaceRoutes(any namespace)
         Remove a namespace's routing table and registration points and return itself.
    private any renderResponse(any route, any event)
         Render a RESTful response.
    private any serializeURL([any formVars=''], any event)
         Serialize a URL when invalid.
    any setAutoReload(any<boolean> autoReload)
         Set the auto reload flag and return itself.
    any setBaseURL(string baseURL)
         Set the base URL for the application and return itself.
    any setEnabled(any<boolean> enabled)
         Set whether the interceptor is enabled or not and return itself.
    any setExtensionDetection(any<boolean> extensionDetection)
         Call it to activate/deactivate automatic extension detection and return itself.
    any setLooseMatching(any<boolean> looseMatching)
         Set the loose matching property of the interceptor and return itself.
    void setModuleRoutingTable(any<struct> routes)
         Set the module routing table.
    void setRoutes(any<array> routes)
         Internal override of the routes array.
    any setThrowOnInvalidExtension(any<boolean> throwOnInvalidExtension)
         Configure the interceptor to throw an exception or not when invalid extensions are detected and return itself.
    any setUniqueURLs(any<boolean> uniqueURLs)
         Set the uniqueURLs property and return itself.
    any setValidExtensions(any validExtensions)
         Setup the list of valid extensions to detect automatically for you.
    any with([string pattern], [string handler], [any action], [boolean packageResolverExempt], [string matchVariables], [string view], [boolean viewNoLayout], [boolean valuePairTranslation], [any constraints], [string module], [string moduleRouting], [string namespace], [string namespaceRouting], [boolean ssl], [boolean append])
         Starts a with closure, where all arguments will be prefixed for the next concatenated addRoute() methods until an endWith() is called.
     
    Methods inherited from class coldbox.system.Interceptor
    appendToBuffer, clearBuffer, getBufferObject, getBufferString, getCachebox, getFlash, getInterceptorService, getLog, getLogBox, getProperties, getProperty, getWirebox, init, propertyExists, setCachebox, setFlash, setInterceptorService, setLog, setLogBox, setProperties, setProperty, setWirebox, unregister
     
    Methods inherited from class coldbox.system.FrameworkSupertype
    addAsset, announceInterception, getCache, getController, getDatasource, getInstance, getInterceptor, getModel, getModuleConfig, getModuleSettings, getMyPlugin, getPlugin, getRenderer, getRequestCollection, getRequestContext, getSetting, getSettingStructure, includeUDF, loadApplicationHelpers, locateDirectoryPath, locateFilePath, persistVariables, populateModel, renderExternalView, renderLayout, renderView, runEvent, setController, setNextEvent, setSetting, settingExists
     
    Methods inherited from class railo-context.Component
    None

    Method Detail

    addModuleRoutes

    public any addModuleRoutes(string pattern, string module, [boolean append='true'])

    Register modules routes in the specified position in the main routing table, and returns itself

    Parameters:
    pattern - The pattern to match against the URL.
    module - The module to load routes for
    append - Whether the module entry point route should be appended or pre-pended to the main routes array. By default we append to the end of the array

    addNamespace

    public any addNamespace(string pattern, string namespace, [boolean append='true'])

    Register a namespace in the specified position in the main routing table, and returns itself

    Parameters:
    pattern - The pattern to match against the URL.
    namespace - The name of the namespace to register
    append - Whether the route should be appended or pre-pended to the array. By default we append to the end of the array

    addRoute

    public any addRoute(string pattern, [string handler], [any action], [boolean packageResolverExempt='false'], [string matchVariables], [string view], [boolean viewNoLayout='false'], [boolean valuePairTranslation='true'], [any constraints=''], [string module=''], [string moduleRouting=''], [string namespace=''], [string namespaceRouting=''], [boolean ssl='false'], [boolean append='true'], [any response], [numeric statusCode], [string statusText], [any condition])

    Adds a route to dispatch and returns itself.

    Parameters:
    pattern - The pattern to match against the URL.
    handler - The handler to execute if pattern matched.
    action - The action in a handler to execute if a pattern is matched. This can also be a structure based on the HTTP method(GET,POST,PUT,DELETE). ex: {GET:'show', PUT:'update', DELETE:'delete', POST:'save'}
    packageResolverExempt - If this is set to true, then the interceptor will not try to do handler package resolving. Else a package will always be resolved. Only works if :handler is in a pattern
    matchVariables - A string of name-value pair variables to add to the request collection when this pattern matches. This is a comma delimmitted list. Ex: spaceFound=true,missingAction=onTest
    view - The view to dispatch if pattern matches. No event will be fired, so handler,action will be ignored.
    viewNoLayout - If view is choosen, then you can choose to override and not display a layout with the view. Else the view renders in the assigned layout.
    valuePairTranslation - Activate convention name value pair translations or not. Turned on by default
    constraints - A structure of regex constraint overrides for variable placeholders. The key is the name of the variable, the value is the regex to try to match.
    module - The module to add this route to
    moduleRouting - Called internally by addModuleRoutes to add a module routing route.
    namespace - The namespace to add this route to
    namespaceRouting - Called internally by addNamespaceRoutes to add a namespaced routing route.
    ssl - Makes the route an SSL only route if true, else it can be anything. If an ssl only route is hit without ssl, the interceptor will redirect to it via ssl
    append - Whether the route should be appended or pre-pended to the array. By default we append to the end of the array
    response - An HTML response string to send back or a closure to be executed that should return the response. The closure takes in a 'params' struct of all matched params and the string will be parsed with the named value pairs as ${param}
    statusCode - The HTTP status code to send to the browser response.
    statusText - Explains the HTTP status code sent to the browser response.
    condition - A closure or UDF to execute that MUST return true to use route if matched or false and continue.

    checkForInvalidURL

    private void checkForInvalidURL(any route, any script_name, any event)

    Check for invalid URL's

    Parameters:
    route
    script_name
    event

    configure

    public void configure()

    This is where the ses service configures itself.

    Overrides:
    configure in class Interceptor

    detectExtension

    private any detectExtension(any requestString, any event)

    Detect extensions from the incoming request

    Parameters:
    requestString - The requested URL string
    event - The event object.

    endWith

    public any endWith()

    End a with closure and returns itself


    findConventionNameValuePairs

    private void findConventionNameValuePairs(string requestString, any match, struct params)

    Find the convention name value pairs

    Parameters:
    requestString - The request string
    match - The regex matcher
    params - The parameter structure

    findRoute

    private any findRoute(any action, any event, [any module=''], [any namespace=''])

    Figures out which route matches this request and returns a routed structure

    Parameters:
    action - The action evaluated by the path_info
    event - The event object.
    module - Find a route on a module
    namespace - Find a route on a namespace

    fixIISURLVars

    private any fixIISURLVars(any requestString, any rc)

    Clean up some IIS funkyness

    Parameters:
    requestString - The request string
    rc - The request collection

    getAutoReload

    public any<boolean> getAutoReload()

    Set to auto reload the rules in each request


    getBaseURL

    public string getBaseURL()

    Get BaseURL


    getCGIElement

    private any getCGIElement(any cgielement, any Event)

    The cgi element facade method

    Parameters:
    cgielement - The cgi element to retrieve
    Event - The event object.

    getCleanedPaths

    private any getCleanedPaths(any rc, any event)

    Get and Clean the path_info and script names structure

    Parameters:
    rc - The request collection to incorporate items into
    event - The event object.

    getEnabled

    public any<boolean> getEnabled()

    Get enabled


    getExtensionDetection

    public any<boolean> getExtensionDetection()

    Get the flag if extension detection is enabled


    getLooseMatching

    public any<boolean> getLooseMatching()

    Get the current loose matching property


    getModuleRoutes

    public any<array> getModuleRoutes(any module='')

    Get a modules routes array

    Parameters:
    module - The name of the module

    getModulesRoutingTable

    public any<struct> getModulesRoutingTable()

    Get the entire modules routing table


    getNamespaceRoutes

    public any<array> getNamespaceRoutes(any namespace)

    Get a namespace routes array

    Parameters:
    namespace - The name of the namespace

    getNamespaceRoutingTable

    public any<struct> getNamespaceRoutingTable()

    Get the entire namespace routing table


    getRoutes

    public any<array> getRoutes()

    Get the array containing all the routes


    getThrowOnInvalidExtension

    public any<boolean> getThrowOnInvalidExtension()

    Get if we are throwing or not on invalid extension detection


    getUniqueURLs

    public any<boolean> getUniqueURLs()

    Get uniqueURLs


    getUtil

    private any<Util> getUtil()

    Create and return a util object


    getValidExtensions

    public any getValidExtensions()

    Get the list of valid extensions this interceptor allows


    importConfiguration

    private void importConfiguration()

    Import the routing configuration file


    includeRoutes

    public any includeRoutes(any location)

    Includes a routes configuration file as an added import and returns itself after import

    Parameters:
    location - The include location of the routes configuration template. Do not add '.cfm'

    onRequestCapture

    public void onRequestCapture(any event, any interceptData)

    This is the route dispatch

    Parameters:
    event - The event object.
    interceptData - interceptData of intercepted info.

    packageResolver

    private any packageResolver(any routingString, any routeParams, [any module=''])

    Resolve handler/module packages

    Parameters:
    routingString - The routing string
    routeParams - The routed params array
    module - Tells package resolver this is an explicit module package resolving call

    processRouteOptionals

    private void processRouteOptionals(struct thisRoute)

    Process route optionals

    Parameters:
    thisRoute - The route struct

    processWith

    private any processWith(any args)

    Process a with closure

    Parameters:
    args - The arguments to process

    removeModuleRoutes

    public any removeModuleRoutes(any module)

    Remove a module's routing table and registration points and return itself

    Parameters:
    module - The name of the module to remove

    removeNamespaceRoutes

    public any removeNamespaceRoutes(any namespace)

    Remove a namespace's routing table and registration points and return itself

    Parameters:
    namespace - The name of the namespace to remove

    renderResponse

    private any renderResponse(any route, any event)

    Render a RESTful response

    Parameters:
    route - The route response
    event - The event object.

    serializeURL

    private any serializeURL([any formVars=''], any event)

    Serialize a URL when invalid

    Parameters:
    formVars
    event

    setAutoReload

    public any setAutoReload(any<boolean> autoReload)

    Set the auto reload flag and return itself

    Parameters:
    autoReload

    setBaseURL

    public any setBaseURL(string baseURL)

    Set the base URL for the application and return itself

    Parameters:
    baseURL

    setEnabled

    public any setEnabled(any<boolean> enabled)

    Set whether the interceptor is enabled or not and return itself

    Parameters:
    enabled

    setExtensionDetection

    public any setExtensionDetection(any<boolean> extensionDetection)

    Call it to activate/deactivate automatic extension detection and return itself

    Parameters:
    extensionDetection

    setLooseMatching

    public any setLooseMatching(any<boolean> looseMatching)

    Set the loose matching property of the interceptor and return itself

    Parameters:
    looseMatching

    setModuleRoutingTable

    public void setModuleRoutingTable(any<struct> routes)

    Set the module routing table

    Parameters:
    routes

    setRoutes

    public void setRoutes(any<array> routes)

    Internal override of the routes array

    Parameters:
    routes

    setThrowOnInvalidExtension

    public any setThrowOnInvalidExtension(any<boolean> throwOnInvalidExtension)

    Configure the interceptor to throw an exception or not when invalid extensions are detected and return itself

    Parameters:
    throwOnInvalidExtension

    setUniqueURLs

    public any setUniqueURLs(any<boolean> uniqueURLs)

    Set the uniqueURLs property and return itself

    Parameters:
    uniqueURLs

    setValidExtensions

    public any setValidExtensions(any validExtensions)

    Setup the list of valid extensions to detect automatically for you.: e.g.: json,xml,rss. Return itself

    Parameters:
    validExtensions - A list of valid extensions to allow in a request

    with

    public any with([string pattern], [string handler], [any action], [boolean packageResolverExempt], [string matchVariables], [string view], [boolean viewNoLayout], [boolean valuePairTranslation], [any constraints], [string module], [string moduleRouting], [string namespace], [string namespaceRouting], [boolean ssl], [boolean append])

    Starts a with closure, where all arguments will be prefixed for the next concatenated addRoute() methods until an endWith() is called

    Parameters:
    pattern - The pattern to match against the URL.
    handler - The handler to execute if pattern matched.
    action - The action in a handler to execute if a pattern is matched. This can also be a structure based on the HTTP method(GET,POST,PUT,DELETE). ex: {GET:'show', PUT:'update', DELETE:'delete', POST:'save'}
    packageResolverExempt - If this is set to true, then the interceptor will not try to do handler package resolving. Else a package will always be resolved. Only works if :handler is in a pattern
    matchVariables - A string of name-value pair variables to add to the request collection when this pattern matches. This is a comma delimmitted list. Ex: spaceFound=true,missingAction=onTest
    view - The view to dispatch if pattern matches. No event will be fired, so handler,action will be ignored.
    viewNoLayout - If view is choosen, then you can choose to override and not display a layout with the view. Else the view renders in the assigned layout.
    valuePairTranslation - Activate convention name value pair translations or not. Turned on by default
    constraints - A structure of regex constraint overrides for variable placeholders. The key is the name of the variable, the value is the regex to try to match.
    module - The module to add this route to
    moduleRouting - Called internally by addModuleRoutes to add a module routing route.
    namespace - The namespace to add this route to
    namespaceRouting - Called internally by addNamespaceRoutes to add a namespaced routing route.
    ssl - Makes the route an SSL only route if true, else it can be anything. If an ssl only route is hit without ssl, the interceptor will redirect to it via ssl
    append - Whether the route should be appended or pre-pended to the array. By default we append to the end of the array