Am 16.01.17 um 10:17 schrieb John from Decent Espresso:
A different topic. I use the code patch below to get rid of the need
for ".adp" on the end of my URLs.
In other words, naviserver transparently rewrites
https://decentespresso.com/cart
as
https://decentespresso.com/cart.adp
and doesn’t display the .adp to the user in the browser. This makes
for very clear urls.
This works for me, but would you recommend a less hard-wired hack to
accomplish this same thing?
You have asked this question before:
[1] https://sourceforge.net/p/naviserver/mailman/message/32586538/
I don't like a hard-coded approach - the C code is agnostic on the .adp
extension. One would probably want to have the following behavior on an
URL ending with "/file" or "/file.adp":
called "file exists" "file.adp exists" action
=====================================================================
file 1 1 deliver "file"
file 1 0 deliver "file"
file 0 1 deliver "file.adp"
file 0 0 error
file.adp 1 1 deliver "file.adp"
file.adp 1 0 deliver "file"
file.adp 0 1 deliver "file.adp"
file.adp 0 0 error
A filter can achieve this behavior (see jeffs solution in the thread
above), which checks at runtime e.g. if "file" exists, and if not to try
"file.adp".
However, one does not want to run the filter on every requests, and the
approach should be compatible with the way how NaviServer configuration
works for choosing on which files the ADP parser should be used. This is
happening now via ns_register_adp (see [1]) using a config section like:
ns_section "ns/server/default/adp"
ns_param map /*.adp
ns_param disabled false
One approach would be to allow mapping rules for the URLspace machinery
for empty extensions (something, which does not exist yet). Such a
mapping rule could be used for a filter for only urls without
extensions, or it could be used to map adp pages with empty extensions
with "ns_register_adp" like above and let the ADP "PageRequest" check,
if a file with ".adp" exists. Such a syntactic rule for for the URLspace
could be used as well in other operations on the URLspace (for
registering procs, connection pool mapping, ns_urlspace, etc.). This
would be backward compatible and avoid overall overhead....
-g
PS: As we are using on our main sites OpenACS, we do not have this
problem, since OpenACS defines its own "request processor" which handles
every URL.
https://bitbucket.org/naviserver/naviserver/src/a6cf227cad8d0c03dc3dff3c643b704e06ea1238/tcl/config.tcl?at=default&fileviewer=file-view-default#config.tcl-120
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel