On Fri, Oct 17, 2008 at 4:01 PM, Judah McAuley <[EMAIL PROTECTED]> wrote:

> Those are some fine points. I presume that in all cases, you have to
> have your webserver not check for the existence of a file before handing
> off the request.

Correct. This is why there is a problem when the visitor is trying to get a
directory's default document. The webserver always checks for a default
document, even when the "don't check for document's existence" is set to
off.


> I'm curious about the efficiency argument there. I can see your point
> about the webserver not having to look at calls for a js file or css
> file or what have you, but the lookup in the url rewriter is usually a
> pretty straight forward regex with exclusion rules for file extensions
> (css, js, gif, etc). How much overhead do you think that adds? Versus

The exclusion rules still have to be written and checked. All of the regex
rules in a rewriter file have to be checked to see if any match. Even if you
set the regex tests to stop after the first match a check will be made.

onmissingtemplate() which will only run when a CF file is requested,
> but it will have to look for the existence of a file before firing the
> handler.

This is done anyway. All the handler does is step between the request and
the global missing template handler. There is nothing really extra for its
usage.


> If you are running through a rewriter, you are probably
> sending every request to a single file (index.cfm) or perhaps a couple
> files, so the existence of that file will probably be cached.

Not always. While some may use a single file for all rewrites, I'd expect
that people would use more than one for different operations. A missing
template goes to X when in one directory and Y when in another, especially
when dealing with seperate applications (blog, forum, etc.). And that
assumes that your only using a missing template style rewriter. What about
when you have a request come in for a file with extension X but you want it
to run as extension Y (a good seo practice when dealing with dynamic pages
without passed variables).


> But if
> you are throwing a bunch of urls at cf that all look like different
> file names "/my-article-1.cfm, /my-article-2.cfm, etc) then it will
> have to look for the existence of every unique url before firing the
> handler.

Already being done so not an issue.


> Have you done any overhead comparison between the two methods?

None worth talking about. My tests have all been 'real world' and if it runs
quickly, efficiently and makes the client happy, then it's ok with me. :)
I use both techniques for different sites and I prefer the
onmissingtemplate() way more because it just feels 'cleaner' and more
integrated into my application. I can have a single directory with an
application.cfc that inherits from the root one. This child application.cfc
can have the onmissingtemplate() and nothing else, making it very specific
to the type of template expected. I usually have an index.cfm and some form
of base template in the directory as well for a standard layout.
Here's an exmaple from a client sub-site written almost totally in CF8.
http://www.800renewable.com/glossary/

The glossary has an index.cfm and an application.cfc. When a request comes
in for a glossary item, we know that it will not exist so the
onmissingtemplate() handler (the only thing in the application.cfc) will run
and provide the content. Very clean.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:314064
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to