rp_serve_abstract_file (private)
rp_serve_abstract_file [ -noredirect ] [ -nodirectory ] \ [ -extension_pattern extension_pattern ] path
Defined in packages/acs-tcl/tcl/request-processor-procs.tcl
Serves up a file given the abstract path. Raises the following exceptions in the obvious cases:
Should not be used in .vuh files or elsewhere, instead use the public function rp_internal_redirect.
- notfound (passes back an empty value)
- redirect (passes back the url to which it wants to redirect)
- directory (passes back the path of the directory)
- Switches:
- -noredirect (optional, boolean)
- -nodirectory (optional, boolean)
- -extension_pattern (optional, defaults to
".*"
)- Parameters:
- path (required)
- See Also:
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: if {[string index $path end] eq "/"} { if { [ad_file isdirectory $path] } { # The path specified was a directory; return its index file. # Directory name with trailing slash. Search for an index.* file. # Remember the name of the directory in $dir_index, so we can later # generate a directory listing if necessary. set dir_index $path set path "[string trimright $path /]/index" } else { # If there's a trailing slash on the path, the URL must refer to a # directory (which we know doesn't exist, since [ad_file isdirectory $path] # returned 0). ad_raise notfound } } ### no more trailing slash. if { [ad_file isfile $path] } { # It's actually a file. ad_conn -set file $path } else { # The path provided doesn't correspond directly to a file - we # need to glob. (It could correspond directly to a directory.) if { ![file isdirectory [ad_file dirname $path]] } { ad_raise notfound } ad_conn -set file [rp_concrete_file -extension_pattern $extension_pattern $path] if { [ad_conn file] eq "" } { if { [ad_file isdirectory $path] && !$noredirect_p } { # Directory name with no trailing slash. Redirect to the same # URL but with a trailing slash. set url "[ad_conn url]/" if { [ad_conn query] ne "" } { append url "?[ad_conn query]" } ad_raise redirect $url } else { if { [info exists dir_index] && !$nodirectory_p } { ad_raise directory $dir_index } else { # Nothing at all found! 404 time. ad_raise notfound } } } } rp_serve_concrete_file [ad_conn file]XQL Not present: Generic, PostgreSQL, Oracle