这种方式不可能请求到docroot区域以外的文件。这样你可以很容易的保护其他文件(比如 webapp的源文件代码),只要你把他们放到其他目录。您可能会随意的使用 documentAllower函数,但它确实方便,快速。
There is a big exception to the simple URL-to-filesystem mapping: Snakelets. Dynamic content created by a snakelet page is not found on disk in the regular way. Instead, there is a snakelet object defined in your Python source code that is called by the server when a URL is requested that triggers the snakelet. Which URLs trigger which snakelets, is configured in the "snakelets" attribute in your webapp init file (see above). Because you can use simple wildcard patterns there, a lot of URLs may be mapped onto a single snakelet object.
在URL到系统文件的映射问题上有一个例外:Snakelets。被snakelet 创建的动态内容在硬盘上是着不到的。他是定义在你的python源文件中的对象,当URL被请求的时候server会调用他从而触发snakelet。哪一个URL触发哪一个snakelets,这都定义在您的web app 的 init(初始化)文件中(见前面文章)。因为您可以使用通配符号,所以大部分的URL可以映射到单一的snakelet对象。
The server uses the following order to determine what is returned for a requested URL:
server 返回下面几种URL请求:
[list]
1. Snakelet url/patterns
2. Dynamic page (Ypage)
3. Static page/file (.html etc)
[/list]
[size=18]Index pages[/size]
When you leave out a specific page name from an url (example: http://server.com/app/info/) the server will try to fetch the index page for that directory. If there is a file index.html (or index.y) in that location, Snakelets will load that one. It is as if you typed the url http://server.com/app/info/index.y.
See above at the indexPages variable what the default list of files is that are searched for, and how you can change this.
当您没有对url指定页面名称的时候(如:http://server.com/app/info/)server就会自动尝试此目录中的 index 页面(或 index.y)。和使用url http://server.com/app/info/index.y。如何设置默认页请见前面文章。
Snakelet as index page: if no other suitable page is found, the server will also try to use a Snakelet as index page. You have to configure a snakelet with a suitable URL pattern to make this work. The server looks for index.sn Snakelet in the requested URL path, so when the URL "http://server.com/test/dir/" is requested and you have configured a snakelet in the "test" webapp on the pattern dir/index.sn or */index.sn it will be used as index page. You can also use a Snakelet as 'root' index page in your webapp, but you will have to add it explicitly to the Snakelet list (because of the way the fnmatch urlpatterns work): use the pattern index.sn (no pre- or suffixes).
上一页 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1516 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 下一页
| 论坛热门帖子: | [lch203] 写得蛮好的linux学习笔记(10-21) [黑马制造] 学习java的30个目标(10-19) [笑傲股林] 做测试半年了,有点迷茫,应该再学些什么提高自己的测试水平和测试能力呢?(10-19) [udp8589] 大家用google的来吱一声? 用百度的~~也来报道下?(10-18) [沂偌掳兆] 本人总结的一些认为C++比较经典的书籍,希望对大家有用(10-18) |
| TAG标签: | 翻译 文档 使用 可以 页面 URL 如果 文件 webapp 一个 |
注册
个人空间
