ADAPT::context_name

Description

This iRules command returns the name of a context. The name of a dynamic context was specified when it was created. The name of a static (profile) context is that of the profile.

Syntax

ADAPT::context_name <ctx>

Examples

when HTTP_REQUEST {
    log local0. “Event HTTP_REQUEST"
    # Disable the static configs (templates for dynamic)
    ADAPT::enable request false
    ADAPT::enable response false
    # Create the first dynamic context on the clientside and configure it.
    set req_ctx1 [ADAPT::context_create req_ctx1]
    ADAPT::select $req_ctx1 /Common/ivs-req1-example
    ADAPT::enable $req_ctx1 true
    # Create the first dynamic context on the serverside and configure it (pending).
    set rsp_ctx1 [ADAPT::context_create response rsp_ctx1]
    ADAPT::select $rsp_ctx1 /Common/ivs-rsp1-example
    ADAPT::enable $rsp_ctx1 true
}
when ADAPT_REQUEST_RESULT {
    set ctx [ADAPT::context_current]
    set ctx_name [ADAPT::context_name $ctx]
    log local0. "Event ADAPT_REQUEST_RESULT in context $ctx_name"
    if {$ctx == $req_ctx1} {
        # Create the second dynamic context on the clientside and configure it.
        set req_ctx2 [ADAPT::context_create req_ctx2]
        ADAPT::select $req_ctx2 /Common/ivs-req2-example
        ADAPT::enable $req_ctx2 true
        # Create the second dynamic context on the serverside and configure it.
        set rsp_ctx2 [ADAPT::context_create response demo_rsp_ctx2]
        ADAPT::select $rsp_ctx2 /Common/ivs-rsp2-example
        ADAPT::enable $rsp_ctx2 true
    }
}