rp_concrete_file (private)

 rp_concrete_file [ -extension_pattern extension_pattern ] path

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

Given a path in the filesystem, returns the file that would be served, trying all possible extensions. Returns an empty string if there's no file "$path.*" in the filesystem (even if the file $path itself does exist).

Switches:
-extension_pattern (optional, defaults to ".*")
Parameters:
path (required)

Partial Call Graph (max 5 caller/called nodes):
%3 rp_serve_abstract_file rp_serve_abstract_file (private) rp_concrete_file rp_concrete_file rp_serve_abstract_file->rp_concrete_file parameter::get parameter::get (public) rp_concrete_file->parameter::get

Testcases:
No testcase defined.
Source code:
    # Sub out funky characters in the pathname, so the user can't request
    # http://www.arsdigita.com/*/index (causing a potentially expensive glob
    # and bypassing registered procedures)!
    regsub -all -- {[^0-9a-zA-Z_/:.]} $path {\\&} path_glob

    # Grab a list of all available files with extensions.
    set files [glob -nocomplain "$path_glob$extension_pattern"]

    # Search for files in the order specified in ExtensionPrecedence,
    # include always "vuh"
    set precedence [parameter::get -package_id $::acs::kernel_id -parameter ExtensionPrecedence -default tcl]
    foreach extension [concat [split [string trim $precedence","] vuh] {
        if { [lsearch -glob $files "*.$extension"] != -1 } {
            return "$path.$extension"
        }
    }
    #
    # None of the extensions from ExtensionPrecedence were found
    #
    return ""
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: