Redirecting
You can redirect users from your cbwire components similar to how you would in ColdBox using relocate.
1
// File: ./wires/FindADeveloper.cfc
2
3
component extends="cbwire.models.Component"{
4
5
function findADev(){
6
return this.relocate( URL="https://www.ortussolutions.com" );
7
}
8
9
function renderIt(){
10
return this.renderView( "wires/findADev" );
11
}
12
}
13
14
// File: ./views/wires/findADev.cfm
15
16
<cfoutput>
17
<div>
18
<button wire:click="findADev">Help mah code!</button>
19
</div>
20
</cfoutput>
Copied!
In fact, cbwire uses ColdBox's internal relocate() method, so any of the arguments that ColdBox accepts can also be used with cbwire.
1
/**
2
* Relocate user browser requests to other events, URLs, or URIs.
3
*
4
* @event The name of the event to run, if not passed, then it will use the default event found in your configuration file
5
* @URL The full URL you would like to relocate to instead of an event: ex: URL='http://www.google.com'
6
* @URI The relative URI you would like to relocate to instead of an event: ex: URI='/mypath/awesome/here'
7
* @queryString The query string or struct to append, if needed. If in SES mode it will be translated to convention name value pairs
8
* @persist What request collection keys to persist in flash ram
9
* @persistStruct A structure key-value pairs to persist in flash ram
10
* @addToken Wether to add the tokens or not. Default is false
11
* @ssl Whether to relocate in SSL or not
12
* @baseURL Use this baseURL instead of the index.cfm that is used by default. You can use this for ssl or any full base url you would like to use. Ex: https://mysite.com/index.cfm
13
* @postProcessExempt Do not fire the postProcess interceptors
14
* @statusCode The status code to use in the relocation
15
*/
16
void function relocate(
17
event,
18
URL,
19
URI,
20
queryString,
21
persist,
22
struct persistStruct,
23
boolean addToken,
24
boolean ssl,
25
baseURL,
26
boolean postProcessExempt,
27
numeric statusCode
28
);
Copied!
Last modified 6mo ago
Copy link
Edit on GitHub