Forum OpenACS Q&A: Request processor question

Collapse
Posted by Andrei Popov on
Request processor documentation states:
...If the RP can't find any matching files with the expected extensions, it will look for virtual-url-handler files, or .vuh files. A .vuh file will be executed as if it were a Tcl file, but with the tail end of the URL removed.
Is there any way to actually preserve/retrieve the "tail end" of original request? For example, if I want to move from a legacy site engine I was using, but I do want to preserve all of old content and want OACS to handle request to index.pl?show=some-story to look up a some-story.html under /www/ols-site/, the following code (saved as index.vuh) does not help: set url_list [split [ad_conn url] "="] set story [lindex $url_list 1] if { [empty_string_p $story] } { # redirect to old home set home_url "index.pl?show=home" ad_returnredirect "[ad_conn package_url]/$home_url" } else { rp_internal_redirect "/www/old/$story" } Any suggestions?
Collapse
Posted by Jeff Davis on
I think what you want is [ad_conn path_info] not [ad_conn url]
unfortunately it seems not to be in the docs when I looked...
Collapse
Posted by Andrei Popov on
Nope, same result -- I get "number of redirects exceeded...". With some debugging info the following is seen:

index.vuh:

set orig_url [ad_conn url] set path_info [ad_conn path_info] set url_list [split [ad_conn url] "="] set story [lindex $url_list 1] ns_log notice ">>> story: $story url_list: $url_list original_url: $orig_url path_info: $path_info" if { [empty_string_p $story] } { # redirect to old home set home_url "index.pl?show=home" ad_returnredirect "[ad_conn package_url]/$home_url" } else { rp_internal_redirect "/www/old/$story" }

request:

http://localhost:8000/index.pl?show=home

log:

[07/Oct/2002:14:19:41][480.368][-conn1-] Notice: >>> story: url_list: /index.pl original_url: /index.pl path_info: index.pl
Collapse
Posted by Jeff Davis on
Oh sorry, I did not think. The query variables would be parsed, so you could get then via
ad_page_contract { 
   handle legacy links
} { 
     {show home}
}
or get show ns_set get them directly from ns_getform etc. Sorry for the bad advice.
Collapse
Posted by Tilmann Singer on
Try [ad_conn query] - as far as i remember that contains all that is right from the question sign.

If you know and want to manipulate the values, then passing them in via ad_page_contract and constructing the url to redirect to with [export_vars ...] is of course the way to go.

Collapse
Posted by Andrei Popov on
Tilmann, thanks -- it worked.