[Nitro] New Nitro dispatcher proposal
George Moschovitis
george.moschovitis at gmail.com
Mon Jan 22 05:39:21 EST 2007
>
> This is only true with Webrick (as far as I skimmed the code).
no, it works for mongrel and fastcgi too.
> I propose the following change:
> >
> > If the uri contains no extension automatically add the .html extension
> > Does the file pointed to by the uri exist?
> > - yes ? -> the request is handled by the front web server
> > - no? -> the request is handled by Nitro (append x at the end of the
> > extension)
>
> I would rewrite that to:
>
> - Does the file to uri exist?
> - yes : handled by webserver
> - no : handled by nitro
> - append .html to uri
> Does the file to uri exist?
> - yes : handled by webserver
you can't go back to the web server.
- no : handled by nitro, remove .html
> - handle(webserver | nitro) according to above
you have to pre-apply the html extension. I want the webserver to check for
the (potentially cached) version first and only then proxy to nitro.
The 'always append .html' because we can't reliably check what is a file-
> extension and what is not, it just doesn't work out in all cases.
I can't see the problem.
> For example:
> >
> > if request.uri == index, Nitro searches for
> >
> > index -> index.html
> > index.html (front)
> > index.htmlx / index action (nitro)
> > content_type = text/html
>
> How do you translate from .htmlx to 'index' again?
index.htmlx -> index__html == index
screen.cssx -> screen__css
Isn't __ right now used for / ? How would you 'choose' between those
> modes?
hmm you are right here, we have to find another way to encode this. In fact
there is a better solution
(what Rails does btw): pass the extension as a content type, ie both
my_action.html
and
my_action.xml
trigger the same action (my_action) but nitro setups a special content_type
parameter. and you can use code like this:
def my_action
...common code here...
case request.content_type
when 'html'
...
when 'xml'
...
end
What would happen with types Nitro doesn't recognize as 'templateable'?
> Like '.jpg' (maybe dynamic captcha images)?
dynamic.jpg -> dynamic.jpgx -> dynamic(content = jpg)
> Would this 'x' appending simplify nitro internal code or would it add
> another layer of indirection?
the x just denotes a template, ie:
htmlx = a template that generates html
cssx = a template that generates css
xmlx = a template that generates xml
> I would love to hear your thoughts on this new scheme.
>
> Always :P
thanks,
George.
--
http://blog.gmosx.com
http://cull.gr
http://www.joy.gr
http://nitroproject.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/nitro-general/attachments/20070122/253343e7/attachment-0001.html
More information about the Nitro-general
mailing list