coldbox.system.web.context

Class RequestContext

lucee.Component
    extended by coldbox.system.web.context.RequestContext
Direct Known Subclasses:
MockRequestContext , RequestContextDecorator

Copyright Since 2005 ColdBox Framework by Luis Majano and Ortus Solutions, Corp www.ortussolutions.com --- Models a ColdBox request, stores the incoming request collection (FORM/URL/REMOTE) and private request collection. It is also used to determine metadata about a request and helps you build RESTFul responses.

Class Attributes:
  • synchronized : false
  •  
  • accessors : true
  •  
  • persistent : false
  •  
  • serializable : false
  •  
    Property Summary
    type property default serializable required
    any SESBaseURL
          SES Base URL used for the request.

    • access = public
    • returntype = any
    true false
    boolean SESEnabled
          Are we in SES mode for the request or not.

    • access = public
    • returntype = any
    true false
    struct context
          The request context which contains the URL/FORM or any incoming client data.

    • access = public
    • returntype = any
    true false
    any controller
          ColdBox Controller.

    • access = public
    • returntype = any
    true false
    any defaultLayout
          Default system layout.

    • access = public
    • returntype = any
    true false
    any defaultView
          Default system view.

    • access = public
    • returntype = any
    true false
    any eventName
          The incoming event name detection string.

    • access = public
    • returntype = any
    true false
    struct folderLayouts
          Registered system folder layout ref maps.

    • access = public
    • returntype = any
    true false
    boolean isNoExecution
          Execution bit determination.

    • access = public
    • returntype = any
    true false
    struct privateContext
          The private request context which contains safe data your application can produce.

    • access = public
    • returntype = any
    true false
    struct properties
          ColdBox System Properties.

    • access = public
    • returntype = any
    true false
    struct registeredLayouts
          Registered system layout ref maps.

    • access = public
    • returntype = any
    true false
    struct renderingRegions
          View Rendering Regions that we will track.

    • access = public
    • returntype = any
    true false
    struct responseHeaders
          Response headers generated by the ColdBox application NOT the servlet.

    • access = public
    • returntype = any
    true false
    struct routedStruct
          The incoming RESTFul routed struct (if any).

    • access = public
    • returntype = any
    true false
    struct viewLayouts
          Registered system folder view ref maps.

    • access = public
    • returntype = any
    true false
    Constructor Summary
    init(struct properties='[runtime expression]', any controller)
          Constructor.
    Method Summary
    string buildLink([any to], [any queryString=''], [boolean translate='true'], [boolean ssl], [any baseURL=''])
         Builds links to events or URL Routes.
    any clearCollection([boolean private='false'])
         Clears the entire collection.
    any clearPrivateCollection()
         Clears the private collection.
    any collectionAppend(struct collection, [boolean overwrite='false'], [boolean private='false'])
         Append a structure to the collection, with overwrite or not.
    struct getCollection([boolean deepCopy='false'], [boolean private='false'])
         I Get a reference or deep copy of the public or private request Collection.
    string getContext()
    string getController()
    string getCurrentAction()
         Gets the current action requested in the current event.
    string getCurrentEvent()
         Gets the current incoming event.
    string getCurrentHandler()
         Gets the current handler requested in the current event.
    string getCurrentLayout()
         Gets the current set layout for rendering.
    string getCurrentLayoutModule()
         Gets the current set layout's module for rendering.
    string getCurrentModule()
         Gets the current module name, else returns empty string.
    string getCurrentRoute()
         Get the current request's route pattern that matched.
    struct getCurrentRouteMeta()
         Gets the current routed route's metadata struct, if any.
    string getCurrentRouteName()
         Get the current request's routed name.
    struct getCurrentRouteRecord()
         Get the current routed route record in all of its raw glory.
    string getCurrentRoutedModule()
         Get the current routed module that matched the route, if any.
    string getCurrentRoutedNamespace()
         Get the current routed namespace that matched the route, if any.
    string getCurrentRoutedURL()
         Get the current routed URL that matched the route pattern.
    string getCurrentView()
         Gets the current set view the framework will try to render for this request.
    struct getCurrentViewArgs()
         Gets the current set view the framework will try to render for this request.
    string getCurrentViewModule()
         Gets the current set views's module for rendering.
    string getDefaultLayout()
    string getDefaultView()
    struct getEventCacheableEntry()
         Get the event cacheable entry.
    string getEventName()
    struct getExcept(any keys, [boolean private='false'])
         Filters the collection or private collection down to all keys except the provided keys.
    private any getFileMimeType(string extension)
         Get's the file mime type for a given file extension, this is mostly used for file delivery.
    string getFolderLayouts()
    string getFullURL()
         Returns the full url including the protocol, host, and path.
    string getHTMLBaseURL()
         Get the HTML base URL that is used for the HTML tag.
    struct getHTTPBasicCredentials()
         Returns the username and password sent via HTTP basic authentication.
    any getHTTPContent([boolean json='false'], [boolean xml='false'])
         Get the raw HTTP body content with conversions if needed.
    any getHTTPHeader(any header, [any defaultValue=''])
         Get an HTTP header.
    string getHTTPMethod()
         Get the HTTP Request Method Type.
    string getIsNoExecution()
    struct getMemento()
         Get a representation of this instance.
    string getModuleEntryPoint([any module=''])
         Convenience method to get a module's inherited entry point URL, blank if not found.
    string getModuleRoot([any module=''])
         Convenience method to get the current request's module root path.
    struct getOnly(any keys, [boolean private='false'])
         Filters the collection or private collection down to only the provided keys.
    struct getPrivateCollection([boolean deepCopy='false'])
         I get a private collection.
    string getPrivateContext()
    struct getPrivateExcept(any keys)
         Filters the private collection down to all keys except the provided keys.
    struct getPrivateOnly(any keys)
         Filters the private collection down to only the provided keys.
    numeric getPrivateSize()
         Get the private collection Size.
    any getPrivateTrimValue(any name, [any defaultValue])
         Get a trim value from the private request collection.
    any getPrivateValue(any name, [any defaultValue])
         Get a value from the private request collection.
    string getProperties()
    string getRegisteredLayouts()
    struct getRenderData()
         Get the renderData structure.
    string getRenderingRegions()
    any getResponse()
         Get the response object for the current request.
    string getResponseHeaders()
    string getRoutedStruct()
    string getSESBaseURL()
    string getSESEnabled()
    string getSelf()
         Returns index.
    numeric getSize([boolean private='false'])
         Get the collection Size.
    any getTrimValue(any name, [any defaultValue], [boolean private='false'])
         Get a value from the request collection and if simple value, I will trim it.
    any getValue(any name, [any defaultValue], [boolean private='false'])
         Get a value from the public or private request collection.
    struct getViewCacheableEntry()
         Get the event cacheable entry.
    string getViewLayouts()
    boolean isAjax()
         Determines if in an Ajax call or not by looking at the request headers.
    boolean isEventCacheable()
         Check wether the incoming event has been flagged for caching.
    boolean isInvalidHTTPMethod()
         Check if the request was made with an invalid HTTP Method.
    boolean isNoRender()
         Is this a no render request.
    boolean isProxyRequest()
         Is this a coldbox proxy request.
    boolean isSES()
         Verify if SES is enabled or not in the request.
    boolean isSSL()
         Are we in SSL or not? This method looks at CGI.
    boolean isViewCacheable()
         Check wether the incoming view has been flagged for caching.
    any noExecution()
         Set that the request will not execute an incoming event.
    any noLayout()
         Mark this request to not use a layout for rendering.
    any noRender([boolean remove='false'])
         Set the flag that tells the framework not to render, just execute.
    any overrideEvent(any event)
         Override the current event in the request collection.
    any paramPrivateValue(any name, any value)
         Just like cfparam, but for the private request collection.
    any paramValue(any name, any value, [boolean private='false'])
         Just like cfparam, but for the request collection.
    any privateCollectionAppend(struct collection, [boolean overwrite='false'])
         Append a structure to the collection, with overwrite or not.
    boolean privateValueExists(any name)
         Check if a value exists in the private request collection.
    any removeEventCacheableEntry()
         Check wether the incoming event has been flagged for caching.
    any removePrivateValue(any name, [boolean private='false'])
         remove a value in the private request collection.
    any removeValue(any name, [boolean private='false'])
         remove a value in the request collection.
    any renderData([any type='HTML'], any data, [any contentType=''], [any encoding='utf-8'], [numeric statusCode='200'], [any statusText=''], [any location=''], [any jsonCallback=''], [any jsonQueryFormat='true'], [boolean jsonAsText='false'], [any xmlColumnList=''], [boolean xmlUseCDATA='false'], [any xmlListDelimiter=','], [any xmlRootName=''], [struct pdfArgs='[runtime expression]'], [any formats=''], [any formatsView=''], [any formatsRedirect='[runtime expression]'], [boolean isBinary='false'])
         Use this method to tell the framework to render data for you.
    private any renderWithFormats()
         Render data with formats.
    string route(any name, [struct params='[runtime expression]'], [boolean ssl])
         Builds links to named routes with or without parameters.
    any sendFile([any file=''], [any name=''], [any mimeType=''], [any disposition='attachment'], [boolean abortAtEnd='false'], [any extension=''], [boolean deleteFile='false'])
         This method will send a file to the browser or requested HTTP protocol according to arguments.
    any setContext(struct context)
    any setController(any controller)
    any setDefaultLayout(any defaultLayout)
         Override the default layout for a request.
    any setDefaultView(any defaultView)
         Override the default view for a request.
    any setEventCacheableEntry(struct cacheEntry)
         Check wether the incoming event has been flagged for caching.
    any setEventName(any eventName)
    any setFolderLayouts(struct folderLayouts)
    any setHTTPHeader([any statusCode], [any statusText=''], [any name], [any value=''])
         Set an HTTP Response Header.
    RequestContext setIsInvalidHTTPMethod([boolean target='true'])
         Set the invalid http method flag.
    any setIsNoExecution(boolean isNoExecution)
    any setLayout(any name, [any module=''])
         Set the layout to override and render.
    any setMemento(struct memento)
         Override the instance.
    any setPrivateContext(struct privateContext)
    any setPrivateValue(any name, any value)
         Set a value in the private request collection.
    any setProperties(struct properties)
    any setProxyRequest()
         Set that this is a proxy request.
    any setRegisteredLayouts(struct registeredLayouts)
    any setRenderingRegions(struct renderingRegions)
    any setResponseHeaders(struct responseHeaders)
    any setRoutedStruct(struct routedStruct)
         Get the routed structure of key-value pairs.
    any setSESBaseURL(string sesBaseURL)
         Set the ses base URL for this request.
    any setSESEnabled(boolean flag)
         Setter for verifying SES mode.
    any setValue(any name, any value, [boolean private='false'])
         Set a value in the request collection.
    any setView([any view], [struct args='[runtime expression]'], [any layout], [any module=''], [boolean noLayout='false'], [boolean cache='false'], [any cacheTimeout=''], [any cacheLastAccessTimeout=''], [any cacheSuffix=''], [any cacheProvider='template'], [any name])
         Set the view to render in this request.
    any setViewCacheableEntry(struct cacheEntry)
         Set the view cacheable entry.
    any setViewLayouts(struct viewLayouts)
    boolean urlMatches(string path, [boolean exact='false'])
         Tests that a given path exists in the currently routed URL.
    boolean urlMatchesExact(string path)
         Tests that a given path matches exactly to the currently routed URL.
    boolean valueExists(any name, [boolean private='false'])
         Check if a value exists in the request collection.
     
    Methods inherited from class lucee.Component
    None

    Constructor Detail

    init

    public init(struct properties='[runtime expression]', any controller)

    Constructor

    Parameters:
    properties - The ColdBox application settings
    controller - Acess to the system controller

    Property Detail

    SESBaseURL

    property any SESBaseURL

    SES Base URL used for the request

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

    SESEnabled

    property boolean SESEnabled

    Are we in SES mode for the request or not

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

    context

    property struct context

    The request context which contains the URL/FORM or any incoming client data

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

    controller

    property any controller

    ColdBox Controller

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

    defaultLayout

    property any defaultLayout

    Default system layout

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

    defaultView

    property any defaultView

    Default system view

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

    eventName

    property any eventName

    The incoming event name detection string

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

    folderLayouts

    property struct folderLayouts

    Registered system folder layout ref maps

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

    isNoExecution

    property boolean isNoExecution

    Execution bit determination. Used to determine if the request is executable or not

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

    privateContext

    property struct privateContext

    The private request context which contains safe data your application can produce

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

    properties

    property struct properties

    ColdBox System Properties

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

    registeredLayouts

    property struct registeredLayouts

    Registered system layout ref maps

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

    renderingRegions

    property struct renderingRegions

    View Rendering Regions that we will track

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

    responseHeaders

    property struct responseHeaders

    Response headers generated by the ColdBox application NOT the servlet

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

    routedStruct

    property struct routedStruct

    The incoming RESTFul routed struct (if any)

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

    viewLayouts

    property struct viewLayouts

    Registered system folder view ref maps

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

    Method Detail

    buildLink

    public string buildLink([any to], [any queryString=''], [boolean translate='true'], [boolean ssl], [any baseURL=''])

    Builds links to events or URL Routes

    Parameters:
    to - The event or route path you want to create the link to
    queryString - The query string to append which can be a regular query string string, or a struct of name-value pairs
    translate - Translate between . to / depending on the SES mode on to and queryString arguments. Defaults to true.
    ssl - Turn SSl on/off on URL creation, by default is SSL is enabled, we will use it.
    baseURL - If not using SES, you can use this argument to create your own base url apart from the default of index.cfm. Example: https://mysample.com/index.cfm

    clearCollection

    public any clearCollection([boolean private='false'])

    Clears the entire collection

    Parameters:
    private - Use public or private request collection

    clearPrivateCollection

    public any clearPrivateCollection()

    Clears the private collection


    collectionAppend

    public any collectionAppend(struct collection, [boolean overwrite='false'], [boolean private='false'])

    Append a structure to the collection, with overwrite or not. Overwrite = false by default

    Parameters:
    collection - The collection to incorporate
    overwrite - Overwrite elements, defaults to false
    private - Private or public, defaults public.

    getCollection

    public struct getCollection([boolean deepCopy='false'], [boolean private='false'])

    I Get a reference or deep copy of the public or private request Collection

    Parameters:
    deepCopy - Default is false, gives a reference to the collection. True, creates a deep copy of the collection.
    private - Use public or private request collection

    getContext

    public string getContext()


    getController

    public string getController()


    getCurrentAction

    public string getCurrentAction()

    Gets the current action requested in the current event


    getCurrentEvent

    public string getCurrentEvent()

    Gets the current incoming event


    getCurrentHandler

    public string getCurrentHandler()

    Gets the current handler requested in the current event


    getCurrentLayout

    public string getCurrentLayout()

    Gets the current set layout for rendering


    getCurrentLayoutModule

    public string getCurrentLayoutModule()

    Gets the current set layout's module for rendering


    getCurrentModule

    public string getCurrentModule()

    Gets the current module name, else returns empty string


    getCurrentRoute

    public string getCurrentRoute()

    Get the current request's route pattern that matched


    getCurrentRouteMeta

    public struct getCurrentRouteMeta()

    Gets the current routed route's metadata struct, if any Returns an empty struct if no record was found.


    getCurrentRouteName

    public string getCurrentRouteName()

    Get the current request's routed name


    getCurrentRouteRecord

    public struct getCurrentRouteRecord()

    Get the current routed route record in all of its raw glory Returns an empty struct if no record was found.


    getCurrentRoutedModule

    public string getCurrentRoutedModule()

    Get the current routed module that matched the route, if any


    getCurrentRoutedNamespace

    public string getCurrentRoutedNamespace()

    Get the current routed namespace that matched the route, if any


    getCurrentRoutedURL

    public string getCurrentRoutedURL()

    Get the current routed URL that matched the route pattern


    getCurrentView

    public string getCurrentView()

    Gets the current set view the framework will try to render for this request


    getCurrentViewArgs

    public struct getCurrentViewArgs()

    Gets the current set view the framework will try to render for this request


    getCurrentViewModule

    public string getCurrentViewModule()

    Gets the current set views's module for rendering


    getDefaultLayout

    public string getDefaultLayout()


    getDefaultView

    public string getDefaultView()


    getEventCacheableEntry

    public struct getEventCacheableEntry()

    Get the event cacheable entry


    getEventName

    public string getEventName()


    getExcept

    public struct getExcept(any keys, [boolean private='false'])

    Filters the collection or private collection down to all keys except the provided keys.

    Parameters:
    keys - A list or array of keys to exclude from the results of the collection or private collection.
    private - Private or public, defaults public request collection

    getFileMimeType

    private any getFileMimeType(string extension)

    Get's the file mime type for a given file extension, this is mostly used for file delivery. If not in the most common, we deliver as a binary octet-stream.

    Parameters:
    extension - The extension to assume.

    getFolderLayouts

    public string getFolderLayouts()


    getFullURL

    public string getFullURL()

    Returns the full url including the protocol, host, and path. Handles SES urls gracefully.


    getHTMLBaseURL

    public string getHTMLBaseURL()

    Get the HTML base URL that is used for the HTML tag. This also accounts for SSL or not.


    getHTTPBasicCredentials

    public struct getHTTPBasicCredentials()

    Returns the username and password sent via HTTP basic authentication


    getHTTPContent

    public any getHTTPContent([boolean json='false'], [boolean xml='false'])

    Get the raw HTTP body content with conversions if needed

    Parameters:
    json - Try to return the content as deserialized json
    xml - Try to return the content as an XML object

    getHTTPHeader

    public any getHTTPHeader(any header, [any defaultValue=''])

    Get an HTTP header. If the header doesn't exist the default value of empty string is returned.

    Parameters:
    header - The header to get
    defaultValue - The default value, if not found

    getHTTPMethod

    public string getHTTPMethod()

    Get the HTTP Request Method Type


    getIsNoExecution

    public string getIsNoExecution()


    getMemento

    public struct getMemento()

    Get a representation of this instance


    getModuleEntryPoint

    public string getModuleEntryPoint([any module=''])

    Convenience method to get a module's inherited entry point URL, blank if not found

    Parameters:
    module - Optional name of the module you want the root for, defaults to the current running module

    getModuleRoot

    public string getModuleRoot([any module=''])

    Convenience method to get the current request's module root path. If no module, then returns empty path. You can also get this from the modules settings

    Parameters:
    module - Optional name of the module you want the root for, defaults to the current running module

    getOnly

    public struct getOnly(any keys, [boolean private='false'])

    Filters the collection or private collection down to only the provided keys.

    Parameters:
    keys - A list or array of keys to bring back from the collection or private collection.
    private - Private or public, defaults public request collection

    getPrivateCollection

    public struct getPrivateCollection([boolean deepCopy='false'])

    I get a private collection

    Parameters:
    deepCopy - Default is false, gives a reference to the collection. True, creates a deep copy of the collection.

    getPrivateContext

    public string getPrivateContext()


    getPrivateExcept

    public struct getPrivateExcept(any keys)

    Filters the private collection down to all keys except the provided keys.

    Parameters:
    keys - A list or array of keys to exclude from the results of the private collection.

    getPrivateOnly

    public struct getPrivateOnly(any keys)

    Filters the private collection down to only the provided keys.

    Parameters:
    keys - A list or array of keys to bring back from the private collection.

    getPrivateSize

    public numeric getPrivateSize()

    Get the private collection Size


    getPrivateTrimValue

    public any getPrivateTrimValue(any name, [any defaultValue])

    Get a trim value from the private request collection.

    Parameters:
    name - The key name
    defaultValue - default value

    getPrivateValue

    public any getPrivateValue(any name, [any defaultValue])

    Get a value from the private request collection.

    Parameters:
    name - The key name
    defaultValue - default value

    getProperties

    public string getProperties()


    getRegisteredLayouts

    public string getRegisteredLayouts()


    getRenderData

    public struct getRenderData()

    Get the renderData structure


    getRenderingRegions

    public string getRenderingRegions()


    getResponse

    public any getResponse()

    Get the response object for the current request. If there is none, then return a new one The response object lives in `prc.response`

    Returns:
    coldbox.system.web.context.Response

    getResponseHeaders

    public string getResponseHeaders()


    getRoutedStruct

    public string getRoutedStruct()


    getSESBaseURL

    public string getSESBaseURL()


    getSESEnabled

    public string getSESEnabled()


    getSelf

    public string getSelf()

    Returns index.cfm?{eventName}=


    getSize

    public numeric getSize([boolean private='false'])

    Get the collection Size

    Parameters:
    private - Private or public, defaults public.

    getTrimValue

    public any getTrimValue(any name, [any defaultValue], [boolean private='false'])

    Get a value from the request collection and if simple value, I will trim it.

    Parameters:
    name - The key name
    defaultValue - default value
    private - Private or public, defaults public.

    getValue

    public any getValue(any name, [any defaultValue], [boolean private='false'])

    Get a value from the public or private request collection.

    Parameters:
    name - The key name
    defaultValue - default value
    private - Private or public, defaults public.

    getViewCacheableEntry

    public struct getViewCacheableEntry()

    Get the event cacheable entry


    getViewLayouts

    public string getViewLayouts()


    isAjax

    public boolean isAjax()

    Determines if in an Ajax call or not by looking at the request headers


    isEventCacheable

    public boolean isEventCacheable()

    Check wether the incoming event has been flagged for caching


    isInvalidHTTPMethod

    public boolean isInvalidHTTPMethod()

    Check if the request was made with an invalid HTTP Method


    isNoRender

    public boolean isNoRender()

    Is this a no render request


    isProxyRequest

    public boolean isProxyRequest()

    Is this a coldbox proxy request


    isSES

    public boolean isSES()

    Verify if SES is enabled or not in the request


    isSSL

    public boolean isSSL()

    Are we in SSL or not? This method looks at CGI.SERVER_PORT_SECURE for indication


    isViewCacheable

    public boolean isViewCacheable()

    Check wether the incoming view has been flagged for caching


    noExecution

    public any noExecution()

    Set that the request will not execute an incoming event. Most likely simulating a servlet call

    Returns:
    RequestContext

    noLayout

    public any noLayout()

    Mark this request to not use a layout for rendering

    Returns:
    RequestContext

    noRender

    public any noRender([boolean remove='false'])

    Set the flag that tells the framework not to render, just execute

    Parameters:
    remove - Remove the flag completely
    Returns:
    RequestContext

    overrideEvent

    public any overrideEvent(any event)

    Override the current event in the request collection. This method does not execute the event, it just replaces the event to be executed by the framework's RunEvent() method. This method is usually called from an onRequestStart or onApplicationStart method

    Parameters:
    event - The event to override with
    Returns:
    RequestContext

    paramPrivateValue

    public any paramPrivateValue(any name, any value)

    Just like cfparam, but for the private request collection

    Parameters:
    name - The key name
    value - The value
    Returns:
    RequestContext

    paramValue

    public any paramValue(any name, any value, [boolean private='false'])

    Just like cfparam, but for the request collection

    Parameters:
    name - The key name
    value - The value
    private - Private or public, defaults public.
    Returns:
    RequestContext

    privateCollectionAppend

    public any privateCollectionAppend(struct collection, [boolean overwrite='false'])

    Append a structure to the collection, with overwrite or not. Overwrite = false by default

    Parameters:
    collection - The collection to incorporate
    overwrite - Overwrite elements, defaults to false

    privateValueExists

    public boolean privateValueExists(any name)

    Check if a value exists in the private request collection

    Parameters:
    name - The key name

    removeEventCacheableEntry

    public any removeEventCacheableEntry()

    Check wether the incoming event has been flagged for caching

    Returns:
    RequestContext

    removePrivateValue

    public any removePrivateValue(any name, [boolean private='false'])

    remove a value in the private request collection

    Parameters:
    name - The key name
    private
    Returns:
    RequestContext

    removeValue

    public any removeValue(any name, [boolean private='false'])

    remove a value in the request collection

    Parameters:
    name - The key name
    private - Private or public, defaults public.
    Returns:
    RequestContext

    renderData

    public any renderData([any type='HTML'], any data, [any contentType=''], [any encoding='utf-8'], [numeric statusCode='200'], [any statusText=''], [any location=''], [any jsonCallback=''], [any jsonQueryFormat='true'], [boolean jsonAsText='false'], [any xmlColumnList=''], [boolean xmlUseCDATA='false'], [any xmlListDelimiter=','], [any xmlRootName=''], [struct pdfArgs='[runtime expression]'], [any formats=''], [any formatsView=''], [any formatsRedirect='[runtime expression]'], [boolean isBinary='false'])

    Use this method to tell the framework to render data for you. The framework will take care of marshalling the data for you

    Parameters:
    type - The type of data to render. Valid types are JSON, JSONP, JSONT, XML, WDDX, PLAIN/HTML, TEXT, PDF. The deafult is HTML or PLAIN. If an invalid type is sent in, this method will throw an error
    data - The data you would like to marshall and return by the framework
    contentType - The content type of the data. This will be used in the cfcontent tag: text/html, text/plain, text/xml, text/json, etc. The default value is text/html. However, if you choose JSON this method will choose application/json, if you choose WDDX or XML this method will choose text/xml for you.
    encoding - The default character encoding to use. The default encoding is utf-8
    statusCode - The HTTP status code to send to the browser. Defaults to 200
    statusText - Explains the HTTP status code sent to the browser.
    location - Optional argument used to set the HTTP Location header
    jsonCallback - Only needed when using JSONP, this is the callback to add to the JSON packet
    jsonQueryFormat - JSON Only: This parameter can be a Boolean value that specifies how to serialize ColdFusion queries or a string with possible values "row", "column", or "struct".
    jsonAsText - If set to false, defaults content mime-type to application/json, else will change encoding to plain/text
    xmlColumnList - XML Only: Choose which columns to inspect, by default it uses all the columns in the query, if using a query
    xmlUseCDATA - XML Only: Use CDATA content for ALL values. The default is false
    xmlListDelimiter - XML Only: The delimiter in the list. Comma by default
    xmlRootName - XML Only: The name of the initial root element of the XML packet
    pdfArgs - All the PDF arguments to pass along to the CFDocument tag.
    formats - The formats list or array that ColdBox should respond to using the passed in data argument. You can pass any of the valid types (JSON,JSONP,JSONT,XML,WDDX,PLAIN,HTML,TEXT,PDF). For PDF and HTML we will try to render the view by convention based on the incoming event
    formatsView - The view that should be used for rendering HTML/PLAIN/PDF. By default ColdBox uses the name of the event as an implicit view
    formatsRedirect - The arguments that should be passed to relcoate as part of a redirect for the HTML action. If the format is HTML and this struct is not empty, ColdBox will call relcoate with these arguments.
    isBinary - Bit that determines if the data being set for rendering is binary or not.

    renderWithFormats

    private any renderWithFormats()

    Render data with formats


    route

    public string route(any name, [struct params='[runtime expression]'], [boolean ssl])

    Builds links to named routes with or without parameters. If the named route is not found, this method will throw an `InvalidArgumentException`. If you need a route from a module then append the module address: `@moduleName` or prefix it like in run event calls `moduleName:routenName` in order to find the right route.

    Parameters:
    name - The name of the route
    params - The parameters of the route to replace
    ssl - Turn SSL on/off or detect it by default
    Throws:
    InvalidArgumentException

    sendFile

    public any sendFile([any file=''], [any name=''], [any mimeType=''], [any disposition='attachment'], [boolean abortAtEnd='false'], [any extension=''], [boolean deleteFile='false'])

    This method will send a file to the browser or requested HTTP protocol according to arguments. CF11+ Compatibility

    Parameters:
    file - The absolute path to the file or a binary file to send
    name - The name to send to the browser via content disposition header. If not provided then the name of the file or a UUID for a binary file will be used
    mimeType - A valid mime type to use. If not passed, then we will try to use one according to file type
    disposition - The browser content disposition (attachment/inline) header
    abortAtEnd - If true, then this method will do a hard abort, we do not recommend this, prefer the event.noRender() for a graceful abort.
    extension - Only used for binary files which types are not determined.
    deleteFile - Delete the file after it has been streamed to the user. Only used if file is not binary.

    setContext

    public any setContext(struct context)

    Parameters:
    context

    setController

    public any setController(any controller)

    Parameters:
    controller

    setDefaultLayout

    public any setDefaultLayout(any defaultLayout)

    Override the default layout for a request

    Parameters:
    defaultLayout
    Returns:
    RequestContext

    setDefaultView

    public any setDefaultView(any defaultView)

    Override the default view for a request

    Parameters:
    defaultView
    Returns:
    RequestContext

    setEventCacheableEntry

    public any setEventCacheableEntry(struct cacheEntry)

    Check wether the incoming event has been flagged for caching

    Parameters:
    cacheEntry - The md entry for caching
    Returns:
    RequestContext

    setEventName

    public any setEventName(any eventName)

    Parameters:
    eventName

    setFolderLayouts

    public any setFolderLayouts(struct folderLayouts)

    Parameters:
    folderLayouts

    setHTTPHeader

    public any setHTTPHeader([any statusCode], [any statusText=''], [any name], [any value=''])

    Set an HTTP Response Header

    Parameters:
    statusCode - the status code
    statusText - the status text
    name - The header name
    value - The header value
    Returns:
    RequestContext

    setIsInvalidHTTPMethod

    public RequestContext setIsInvalidHTTPMethod([boolean target='true'])

    Set the invalid http method flag

    Parameters:
    target

    setIsNoExecution

    public any setIsNoExecution(boolean isNoExecution)

    Parameters:
    isNoExecution

    setLayout

    public any setLayout(any name, [any module=''])

    Set the layout to override and render. Layouts are pre-defined in the config file. However I can override these settings if needed. Do not append a the cfm extension. Private Request Collection name

    Parameters:
    name - The name of the layout to set
    module - The module to use

    setMemento

    public any setMemento(struct memento)

    Override the instance

    Parameters:
    memento

    setPrivateContext

    public any setPrivateContext(struct privateContext)

    Parameters:
    privateContext

    setPrivateValue

    public any setPrivateValue(any name, any value)

    Set a value in the private request collection

    Parameters:
    name - The key name
    value - The value
    Returns:
    RequestContext

    setProperties

    public any setProperties(struct properties)

    Parameters:
    properties

    setProxyRequest

    public any setProxyRequest()

    Set that this is a proxy request

    Returns:
    RequestContext

    setRegisteredLayouts

    public any setRegisteredLayouts(struct registeredLayouts)

    Parameters:
    registeredLayouts

    setRenderingRegions

    public any setRenderingRegions(struct renderingRegions)

    Parameters:
    renderingRegions

    setResponseHeaders

    public any setResponseHeaders(struct responseHeaders)

    Parameters:
    responseHeaders

    setRoutedStruct

    public any setRoutedStruct(struct routedStruct)

    Get the routed structure of key-value pairs. What the ses interceptor could match.

    Parameters:
    routedStruct
    Returns:
    RequestContext

    setSESBaseURL

    public any setSESBaseURL(string sesBaseURL)

    Set the ses base URL for this request

    Parameters:
    sesBaseURL
    Returns:
    RequestContext

    setSESEnabled

    public any setSESEnabled(boolean flag)

    Setter for verifying SES mode

    Parameters:
    flag
    Returns:
    RequestContext

    setValue

    public any setValue(any name, any value, [boolean private='false'])

    Set a value in the request collection

    Parameters:
    name - The key name
    value - The value
    private - Private or public, defaults public.
    Returns:
    RequestContext

    setView

    public any setView([any view], [struct args='[runtime expression]'], [any layout], [any module=''], [boolean noLayout='false'], [boolean cache='false'], [any cacheTimeout=''], [any cacheLastAccessTimeout=''], [any cacheSuffix=''], [any cacheProvider='template'], [any name])

    Set the view to render in this request. Private Request Collection Name: currentView, currentLayout

    Parameters:
    view - The name of the view to set. If a layout has been defined it will assign it, else if will assign the default layout. No extension please
    args - An optional set of arguments that will be available when the view is rendered
    layout - You can override the rendering layout of this setView() call if you want to. Else it defaults to implicit resolution or another override.
    module - The explicit module view
    noLayout - Boolean flag, wether the view sent in will be using a layout or not. Default is false. Uses a pre set layout or the default layout.
    cache - True if you want to cache the rendered view.
    cacheTimeout - The cache timeout in minutes
    cacheLastAccessTimeout - The last access timeout in minutes
    cacheSuffix - Add a cache suffix to the view cache entry. Great for multi-domain caching or i18n caching.
    cacheProvider - The cache provider you want to use for storing the rendered view. By default we use the 'template' cache provider
    name - This triggers a rendering region. This will be the unique name in the request for specifying a rendering region, you can then render it by passing the unique name to renderView();
    Returns:
    RequestContext

    setViewCacheableEntry

    public any setViewCacheableEntry(struct cacheEntry)

    Set the view cacheable entry

    Parameters:
    cacheEntry - The md entry for caching
    Returns:
    RequestContext

    setViewLayouts

    public any setViewLayouts(struct viewLayouts)

    Parameters:
    viewLayouts

    urlMatches

    public boolean urlMatches(string path, [boolean exact='false'])

    Tests that a given path exists in the currently routed URL. If the exact flag is passed, the path must match exactly. Using the `urlMatchesExact` is preferred.

    Parameters:
    path - The path to match in the currently routed URL.
    exact - Flag to do an exact match instead of a partial match
    Returns:
    Boolean

    urlMatchesExact

    public boolean urlMatchesExact(string path)

    Tests that a given path matches exactly to the currently routed URL.

    Parameters:
    path - The path to match exactly to the currently routed URL.
    Returns:
    Boolean

    valueExists

    public boolean valueExists(any name, [boolean private='false'])

    Check if a value exists in the request collection

    Parameters:
    name - The key name
    private - Private or public, defaults public.