lucee.Component coldbox.system.web.context.RequestContext
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.
Property Summary | ||||
---|---|---|---|---|
type | property | default | serializable | required |
struct
|
context
The request context which contains the URL/FORM or any incoming client data.
|
true
|
false
|
|
any
|
controller
ColdBox Controller.
|
true
|
false
|
|
any
|
defaultLayout
Default system layout.
|
true
|
false
|
|
any
|
defaultView
Default system view.
|
true
|
false
|
|
any
|
eventName
The incoming event name detection string.
|
true
|
false
|
|
struct
|
folderLayouts
Registered system folder layout ref maps.
|
true
|
false
|
|
boolean
|
isNoExecution
Execution bit determination.
|
true
|
false
|
|
struct
|
privateContext
The private request context which contains safe data your application can produce.
|
true
|
false
|
|
struct
|
properties
ColdBox System Properties.
|
true
|
false
|
|
struct
|
registeredLayouts
Registered system layout ref maps.
|
true
|
false
|
|
struct
|
renderingRegions
View Rendering Regions that we will track.
|
true
|
false
|
|
struct
|
responseHeaders
Response headers generated by the ColdBox application NOT the servlet.
|
true
|
false
|
|
struct
|
routedStruct
The incoming RESTFul routed struct (if any).
|
true
|
false
|
|
any
|
SESBaseURL
SES Base URL used for the request.
|
true
|
false
|
|
boolean
|
SESEnabled
Are we in SES mode for the request or not.
|
true
|
false
|
|
struct
|
viewLayouts
Registered system folder view ref maps.
|
true
|
false
|
Constructor Summary | |
---|---|
init(struct properties='[runtime expression]', any controller)
Constructor. |
Method Summary | |
---|---|
string
|
buildLink([any to], [boolean translate='true'], [boolean ssl], [any baseURL=''], [any queryString=''])
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 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
|
getCurrentRouteName()
Get the current request's SES route name. |
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 |
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. |
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()
|
string
|
getResponseHeaders()
|
string
|
getRoutedStruct()
|
string
|
getSelf()
Returns index. |
string
|
getSESBaseURL()
|
string
|
getSESEnabled()
|
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
|
valueExists(any name, [boolean private='false'])
Check if a value exists in the request collection. |
Methods inherited from class lucee.Component |
---|
None |
Constructor Detail |
---|
Constructor
properties
- The ColdBox application settingscontroller
- Acess to the system controllerProperty Detail |
---|
The request context which contains the URL/FORM or any incoming client data
access
- publicrequired
- falsereturntype
- anyserializable
- trueColdBox Controller
access
- publicrequired
- falsereturntype
- anyserializable
- trueDefault system layout
access
- publicrequired
- falsereturntype
- anyserializable
- trueDefault system view
access
- publicrequired
- falsereturntype
- anyserializable
- trueThe incoming event name detection string
access
- publicrequired
- falsereturntype
- anyserializable
- trueRegistered system folder layout ref maps
access
- publicrequired
- falsereturntype
- anyserializable
- trueExecution bit determination. Used to determine if the request is executable or not
access
- publicrequired
- falsereturntype
- anyserializable
- trueThe private request context which contains safe data your application can produce
access
- publicrequired
- falsereturntype
- anyserializable
- trueColdBox System Properties
access
- publicrequired
- falsereturntype
- anyserializable
- trueRegistered system layout ref maps
access
- publicrequired
- falsereturntype
- anyserializable
- trueView Rendering Regions that we will track
access
- publicrequired
- falsereturntype
- anyserializable
- trueResponse headers generated by the ColdBox application NOT the servlet
access
- publicrequired
- falsereturntype
- anyserializable
- trueThe incoming RESTFul routed struct (if any)
access
- publicrequired
- falsereturntype
- anyserializable
- trueSES Base URL used for the request
access
- publicrequired
- falsereturntype
- anyserializable
- trueAre we in SES mode for the request or not
access
- publicrequired
- falsereturntype
- anyserializable
- trueRegistered system folder view ref maps
access
- publicrequired
- falsereturntype
- anyserializable
- trueMethod Detail |
---|
Builds links to events or URL Routes
to
- The event or route path you want to create the link totranslate
- 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.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 collectionGets 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
Get the current request's SES route name
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 the event cacheable entry
Filters the collection or private collection down to all keys except the provided keys.
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 collectionGet'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.
extension
- The extension to assume.Returns the full url including the protocol, host, and path. Handles SES urls gracefully.
Get the HTML base URL that is used for the HTML
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 a module's inherited entry point URL, blank if not found
module
- Optional name of the module you want the root for, defaults to the current running moduleConvenience 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 moduleFilters the collection or private collection down to only the provided keys.
keys
- A list or array of keys to bring back from the collection or private collection.private
- Private or public, defaults public request collectionI get a private collection
deepCopy
- Default is false, gives a reference to the collection. True, creates a deep copy of the collection.Filters the private collection down to all keys except the provided keys.
keys
- A list or array of keys to exclude from the results of the private collection.Filters the private collection down to only the provided keys.
keys
- A list or array of keys to bring back from the private collection.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 the renderData structure
Returns index.cfm?{eventName}=
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
Determines if in an Ajax call or not by looking at the request headers
Check wether the incoming event has been flagged for caching
Check if the request was made with an invalid HTTP Method
Is this a no render request
Is this a coldbox proxy request
Verify if SES is enabled or not in the request
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: 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/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 viewformatsRedirect
- 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.Render data with formats
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` in order to find the right route.
name
- The name of the routeparams
- The parameters of the route to replacessl
- Turn SSL on/off or detect it by defaultThis method will send a file to the browser or requested HTTP protocol according to arguments. CF11+ Compatibility
file
- The absolute path to the file or a binary file to sendname
- 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 usedmimeType
- A valid mime type to use. If not passed, then we will try to use one according to file typedisposition
- The browser content disposition (attachment/inline) headerabortAtEnd
- 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.context
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 cachingeventName
folderLayouts
Set an HTTP Response Header
statusCode
- the status codestatusText
- the status textname
- The header namevalue
- The header valueSet the invalid http method flag
target
isNoExecution
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
privateContext
Set a value in the private request collection
name
- The key namevalue
- The valueproperties
Set that this is a proxy request
registeredLayouts
renderingRegions
responseHeaders
Get the routed structure of key-value pairs. What the ses interceptor could match.
routedStruct
Set the ses base URL for this request
sesBaseURL
Setter for verifying SES mode
flag
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 providername
- 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();Set the view cacheable entry
cacheEntry
- The md entry for cachingviewLayouts
Check if a value exists in the request collection
name
- The key nameprivate
- Private or public, defaults public.