1.
get the url like this
var url = context.get(Scope.REQUEST, "urn:ibm:security:asf:request:parameter", "URL");
2.then you can set in the beginning of the rule
if(url != null){
state.put("URL", url);
}
later you can in any mapping rule fetch this using
var url=state.get("URL");
This is just a snippet , you can refine as you would like .