Question

I want to make sure that requests that look like:

index.cfm?action=main.data;a=1;b=2 does not crash. Right now it is trying to

enter image description here

This is a follow up to Is it possible to access the matrix parameters (name-value pair separated by semicolon) in ColdFusion?

On FW/1 where is a good place to intercept actions with semicolons?

Was it helpful?

Solution

Matrix params apply to the request uri, not the query string. They're not matrix params if they occur after the question mark, so the direct question you're asking doesn't really make sense, (in that you have an invalid/corrupt action variable, and thus whatever you're attempting may well be the wrong way to go about it - but without more details it's hard to suggest a better way).

The answer to the more general "how do I modify the action value before FW/1 picks it up?" is: before setupRequestDefaults is called, which means before onRequestStart is called, which means overriding the FW/1 version with your own one, something like...

function onRequestStart ( string targetPath )
{
    var ActionVar = variables.framework.action;

    if ( StructKeyExists(Url,ActionVar) ) Url[ActionVar] = fiddleWithAction(Url[ActionVar]);
    if ( StructKeyExists(Form,ActionVar) ) Form[ActionVar] = fiddleWithAction(Form[ActionVar]);

    super.onRequestStart( argumentcollection=arguments );
}

Where fiddleWithAction is a function to do whatever needs doing (in this instance, a ListFirst(string,';') would do it).

But again, this is very likely not the best way to achieve whatever it is you're trying to do.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top