Re: [Simpleweb-Support] Content Based Resolving
Brought to you by:
niallg
From: Niall G. <gal...@ya...> - 2005-12-02 17:17:08
|
Hi Brian, With regard to directory references that do not end with "/", this is handled in the FileEngine implementation. You can delegate to this when you have to download static content such as images. Regarding content based resolving, it would certainly be an attractive feature. However, how does a template engine know which files are templates? A template with no template markup is still a template. In any event the templating system may have to parse the template to figure out if it is a template, which could be slow. I cannot comment too much on Freemarker, is it able to peek into files and determine whether it is a template or not? Finally, why not resolve in reverse. For instance let everything be a template, and match images and other non-text content to a specific service. For instance resolve match=* name=template type=example.TemplateService resolve match=/*.zip name=file type=example.FileService resolve match=/images/* name=file type=example.FileService Something that may interest you is the tiles implementation in simple.template. It does not use a file extension, instead it caches mismatches. So it assumes everything is a template, if after a peek it turns out not to be this information is cached, so a second peek is not performed. This somewhat reduces the overhead of peeking into the file. Niall --- Brian Davis <wic...@gm...> wrote: > Hmm.. > > The URL resolver is useful under certain contexts... > However.. I can > envision at least 2 scenerios in which I would have > better luck with a > content based resolver. Let me illustrate.. > > Let's say for example that I want to have a url > resolve to my > directorylistingservice... how would i write a regex > to support that.. > while link */ is easy.. what about urls that don't > end in /.. > > a more appropriate check might be .... if (new > File(requestPath).isDirectory() && canRead()) > > Scenerio two.. > > Basically I want to use a template engine such as > FreeMarker on files. > However, I want to use the simple framework to > return everything > else.. (those things that are not FreeMarker > templates)... Now you > might say that link("*.ftl", FreeMarkerService) is > the way to do it.. > > However, it would be better if I could forget the > file extension and > use FreeMarker syntax in .txt, .html, .csv, .xml.. > in this way the web > server could handle the mime typing and the > freemarker engine could > handle the substitution. There is also a case here > for contextual > urls... the idea that urls are important and you > shouldn't confuse the > user by using urls that they dont understand.. > > What I would like to see is a way to pass requests > to the templating > engine.. such that if > TemplateEngine.isTemplate(path) returns true > that the request is passed on to the > TemplateService.. > > Any thoughts would be much appreciated. > > Brian > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do > you grep through log files > for problems? Stop! Download the new AJAX search > engine that makes > searching your log files as easy as surfing the > web. DOWNLOAD SPLUNK! > http://ads.osdn.com/?ad_idv37&alloc_id865&op=click > _______________________________________________ > Simpleweb-Support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simpleweb-support > Niall Gallagher __________________________________________ Yahoo! DSL Something to write home about. Just $16.99/mo. or less. dsl.yahoo.com |