rp_internal_redirect (public)

 rp_internal_redirect [ -absolute_path ] path

Defined in packages/acs-tcl/tcl/request-processor-procs.tcl

Tell the request processor to return some other page. The path can either be relative to the current directory (e.g. "some-template") relative to the server root (e.g. "/packages/my-package/www/some-template"), or an absolute path (e.g. "/home/donb/openacs-4/templates/some-cms-template"). When there is no extension then the request processor will choose the matching file according to the extension preferences. Parameters will stay the same as in the initial request. Keep in mind that if you do an internal redirect to something other than the current directory, relative links returned to the clients browser may be broken (since the client will have the original URL). Use rp_form_put or rp_form_update if you want to feed query variables to the redirected page.

Switches:
-absolute_path (boolean) (optional)
If set the path is an absolute path within the host filesystem
Parameters:
path - path to the file to serve

See Also:
  • rp_form_put, rp_form_update

Partial Call Graph (max 5 caller/called nodes):
%3 test_create_workflow_with_instance create_workflow_with_instance (test xowf) rp_internal_redirect rp_internal_redirect test_create_workflow_with_instance->rp_internal_redirect ad_core_docs_html_redirector ad_core_docs_html_redirector (private) ad_core_docs_html_redirector->rp_internal_redirect packages/acs-api-browser/www/index.tcl packages/acs-api-browser/ www/index.tcl packages/acs-api-browser/www/index.tcl->rp_internal_redirect packages/acs-subsite/www/index.tcl packages/acs-subsite/ www/index.tcl packages/acs-subsite/www/index.tcl->rp_internal_redirect

Testcases:
create_workflow_with_instance
Source code:

    # protect from circular redirects

    if { ![info exists ::__rp_internal_redirect_recursion_counter] } {
        set ::__rp_internal_redirect_recursion_counter 0
    } elseif$::__rp_internal_redirect_recursion_counter > 10 } {
        error "rp_internal_redirect: Recursion limit exceeded."
    } else {
        incr ::__rp_internal_redirect_recursion_counter
    }

    if { [string is false $absolute_path_p] } {
        if { [string index $path 0] ne "/" } {
            # it's a relative path, prepend the current location
            set path "[file dirname [ad_conn file]]/$path"
        } else {
            set path "$::acs::rootdir$path"
        }
    }

    # Save the current file setting.
    set saved_file [ad_conn file]

    rp_serve_abstract_file $path

    #
    # Restore the file setting. We need to do this because
    # rp_serve_abstract_file sets it to the path we internally
    # redirected to, and rp_handler will cache the file setting
    # internally in the ::tcl_url2file variable when PerformanceModeP
    # is switched on. This way it caches the location that was
    # originally requested, not the path that we redirected to.
    #
    ad_conn -set file $saved_file
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: