railo-context.Component coldbox.system.web.context.RequestContext
Copyright Since 2005 ColdBox Framework by Luis Majano and Ortus Solutions, Corp www.coldbox.org | www.luismajano.com | www.ortussolutions.com Models a ColdBox request, stores the incoming request collection and private request collection. It is also used to determine metadata about a request and helps you build RESTFul responses.
Property Summary | ||||
---|---|---|---|---|
type | property | default | serializable | required |
struct
|
context
The request context. |
true
|
false
|
|
any
|
controller
ColdBox Controller. |
true
|
false
|
|
struct
|
privateContext
The private request context. |
true
|
false
|
|
any
|
properties
ColdBox System Properties. |
true
|
false
|
Constructor Summary | |
---|---|
init(struct properties='[runtime expression]', any controller)
Constructor. |
Method Summary | |
---|---|
string
|
buildLink(any linkTo, [boolean translate='true'], [boolean ssl], [any baseURL=''], [any queryString=''])
Builds a link to a passed event, either SES or normal link. |
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()
get: The request context. |
string
|
getController()
get: ColdBox Controller. |
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 SES route that matched. |
string
|
getCurrentRoutedNamespace()
Get the current routed namespace that matched the SES route, if any. |
string
|
getCurrentRoutedURL()
Get the current routed URL that matched the SES route. |
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()
Get's the default layout of the application. |
string
|
getDefaultView()
Get's the default view of the application. |
struct
|
getEventCacheableEntry()
Get the event cacheable entry. |
any
|
getEventName()
Get the event name. |
struct
|
getFolderLayouts()
Get the registered folder layout associations map. |
struct
|
getHTTPBasicCredentials()
Returns the username and password sent via HTTP basic authentication. |
any
|
getHTTPContent([boolean json='false'], [boolean xml='false'])
Get the raw HTTP content. |
any
|
getHTTPHeader(any The header to get, [any defaultValue=''])
Get an HTTP header. |
string
|
getHTTPMethod()
Get the HTTP Request Method Type. |
struct
|
getMemento()
Get a representation of this instance. |
string
|
getModuleRoot([any module=''])
Convenience method to get the current request's module root path. |
struct
|
getPrivateCollection([boolean deepCopy='false'])
I get a private collection. |
string
|
getPrivateContext()
get: The private request context. |
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()
get: ColdBox System Properties. |
struct
|
getRegisteredLayouts()
Get all the registered layouts in the configuration file. |
struct
|
getRenderData()
Get the renderData structure. |
struct
|
getRoutedStruct()
Get the routed structure of key-value pairs. |
string
|
getSelf()
Returns index. |
string
|
getSESBaseURL()
Get the SES base URL for this request. |
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. |
struct
|
getViewLayouts()
Get the registered view layout associations map. |
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
|
isNoExecution()
Determine if we need to execute an incoming event or not. |
boolean
|
isNoRender()
Is this a no render request. |
boolean
|
isProxyRequest()
Is this a coldbox proxy request. |
boolean
|
isSES()
Is this request in SES mode. |
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='query'], [boolean jsonAsText='false'], [any xmlColumnList=''], [boolean xmlUseCDATA='false'], [any xmlListDelimiter=','], [any xmlRootName=''], [struct pdfArgs='[runtime expression]'], [any formats=''], [any formatsView=''], [boolean isBinary='false'])
Use this method to tell the framework to render data for you. |
private any
|
renderWithFormats()
Render data with formats. |
any
|
setContext(struct context)
set: The request context. |
any
|
setController(any controller)
set: ColdBox 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
|
setHTTPHeader([any statusCode], [any statusText=''], [any name], [any value=''])
Set an HTTP Header. |
any
|
setIsSES(boolean isSES)
Is this request in SES mode. |
any
|
setLayout(any name, [any module=''])
Set the layout to override and render. |
any
|
setMemento(struct memento)
Override the instance. |
any
|
setPrivateContext(struct privateContext)
set: The private request context. |
any
|
setPrivateValue(any name, any value)
Set a value in the private request collection. |
any
|
setProperties(any properties)
set: ColdBox System Properties. |
any
|
setProxyRequest()
Set that this is a proxy request. |
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
|
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'])
Set the view to render in this request. |
any
|
setViewCacheableEntry(struct cacheEntry)
Set the view cacheable entry. |
boolean
|
valueExists(any name, [boolean private='false'])
Check if a value exists in the request collection. |
Methods inherited from class railo-context.Component |
---|
None |
Constructor Detail |
---|
Constructor
properties
- The ColdBox application settingscontroller
- Acess to the system controllerProperty Detail |
---|
The request context
required
- falseserializable
- trueColdBox Controller
required
- falseserializable
- trueThe private request context
required
- falseserializable
- trueColdBox System Properties
required
- falseserializable
- trueMethod Detail |
---|
Builds a link to a passed event, either SES or normal link. If the ses interceptor is declared it will create routes
linkTo
- The event or route you want to create the link totranslate
- Translate between . and / depending on the ses mode. So you can just use dot notationssl
- Turn SSl on/off on URL creationbaseURL
- 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.cfmqueryString
- The query string to appendClears the entire collection
private
- Use public or private request collectionClears the private collection
Append a structure to the collection, with overwrite or not. Overwrite = false by default
collection
- The collection to incorporateoverwrite
- Overwrite elements, defaults to falseprivate
- Private or public, defaults public.I Get a reference or deep copy of the public or private request Collection
deepCopy
- Default is false, gives a reference to the collection. True, creates a deep copy of the collection.private
- Use public or private request collectionget: The request context
get: ColdBox Controller
Gets the current action requested in the current event
Gets the current incoming event
Gets the current handler requested in the current event
Gets the current set layout for rendering
Gets the current set layout's module for rendering
Gets the current module name, else returns empty string
Get the current request's SES route that matched
Get the current routed namespace that matched the SES route, if any
Get the current routed URL that matched the SES route
Gets the current set view the framework will try to render for this request
Gets the current set view the framework will try to render for this request
Gets the current set views's module for rendering
Get's the default layout of the application
Get's the default view of the application
Get the event cacheable entry
Get the event name
Get the registered folder layout associations map
Returns the username and password sent via HTTP basic authentication
Get the raw HTTP content
json
- Try to return the content as deserialized jsonxml
- Try to return the content as an XML objectGet an HTTP header
The header to get
defaultValue
- The default value if not foundGet the HTTP Request Method Type
Get a representation of this instance
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
module
- Optional name of the module you want the root for, defaults to the current running moduleI get a private collection
deepCopy
- Default is false, gives a reference to the collection. True, creates a deep copy of the collection.get: The private request context
Get the private collection Size
Get a trim value from the private request collection.
name
- The key namedefaultValue
- default valueGet a value from the private request collection.
name
- The key namedefaultValue
- default valueget: ColdBox System Properties
Get all the registered layouts in the configuration file
Get the renderData structure
Get the routed structure of key-value pairs. What the ses interceptor could match.
Returns index.cfm?{eventName}=
Get the SES base URL for this request
Get the collection Size
private
- Private or public, defaults public.Get a value from the request collection and if simple value, I will trim it.
name
- The key namedefaultValue
- default valueprivate
- Private or public, defaults public.Get a value from the public or private request collection.
name
- The key namedefaultValue
- default valueprivate
- Private or public, defaults public.Get the event cacheable entry
Get the registered view layout associations map
Determines if in an Ajax call or not by looking at the request headers
Check wether the incoming event has been flagged for caching
Determine if we need to execute an incoming event or not
Is this a no render request
Is this a coldbox proxy request
Is this request in SES mode
Are we in SSL or not? This method looks at cgi.server_port_secure for indication
Check wether the incoming view has been flagged for caching
Set that the request will not execute an incoming event. Most likely simulating a servlet call
Mark this request to not use a layout for rendering
Set the flag that tells the framework not to render, just execute
remove
- Remove the flag completelyOverride 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
event
- The event to override withJust like cfparam, but for the private request collection
name
- The key namevalue
- The valueJust like cfparam, but for the request collection
name
- The key namevalue
- The valueprivate
- Private or public, defaults public.Append a structure to the collection, with overwrite or not. Overwrite = false by default
collection
- The collection to incorporateoverwrite
- Overwrite elements, defaults to falseCheck if a value exists in the private request collection
name
- The key nameCheck wether the incoming event has been flagged for caching
remove a value in the private request collection
name
- The key nameprivate
remove a value in the request collection
name
- The key nameprivate
- Private or public, defaults public.Use this method to tell the framework to render data for you. The framework will take care of marshalling the data for you
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 errordata
- The data you would like to marshall and return by the frameworkcontentType
- 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-8statusCode
- The HTTP status code to send to the browser. Defaults to 200statusText
- Explains the HTTP status code sent to the browser.location
- Optional argument used to set the HTTP Location headerjsonCallback
- Only needed when using JSONP, this is the callback to add to the JSON packetjsonQueryFormat
- JSON Only: query or array format for encoding. The default is CF query standardjsonAsText
- If set to false, defaults content mime-type to application/json, else will change encoding to plain/textxmlColumnList
- XML Only: Choose which columns to inspect, by default it uses all the columns in the query, if using a queryxmlUseCDATA
- XML Only: Use CDATA content for ALL values. The default is falsexmlListDelimiter
- XML Only: The delimiter in the list. Comma by defaultxmlRootName
- XML Only: The name of the initial root element of the XML packetpdfArgs
- 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 eventformatsView
- The view that should be used for rendering HTML/PLAIN/PDF. By default ColdBox uses the name of the event as an implicit viewisBinary
- Bit that determines if the data being set for rendering is binary or not.Render data with formats
set: The request context
context
set: ColdBox Controller
controller
Override the default layout for a request
defaultLayout
Override the default view for a request
defaultView
Check wether the incoming event has been flagged for caching
cacheEntry
- The md entry for cachingSet an HTTP Header return RequestContext
statusCode
- the status codestatusText
- the status textname
- The header namevalue
- The header valueIs this request in SES mode
isSES
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
name
- The name of the layout to setmodule
- The module to useOverride the instance
memento
set: The private request context
privateContext
Set a value in the private request collection
name
- The key namevalue
- The valueset: ColdBox System Properties
properties
Set that this is a proxy request
Get the routed structure of key-value pairs. What the ses interceptor could match.
routedStruct
Set the ses base URL for this request
sesBaseURL
Set a value in the request collection
name
- The key namevalue
- The valueprivate
- Private or public, defaults public.Set the view to render in this request. Private Request Collection Name: currentView, currentLayout
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 pleaseargs
- An optional set of arguments that will be available when the view is renderedlayout
- 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 viewnoLayout
- 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 minutescacheLastAccessTimeout
- The last access timeout in minutescacheSuffix
- 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 providerSet the view cacheable entry
cacheEntry
- The md entry for cachingCheck if a value exists in the request collection
name
- The key nameprivate
- Private or public, defaults public.