Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Translate all pages to simplified Chinese
- Loading branch information
1 parent
1a34504
commit 1a655d3
Showing
9 changed files
with
684 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta content="text/html; charset=UTF-8" http-equiv="content-type"> | ||
<title>Comet</title> | ||
</head> | ||
<body class="lift:content_id=main"> | ||
<div id="main" class="lift:surround?with=default;at=content"> | ||
<p> | ||
<big> | ||
<big> | ||
Lift的一个关键功能就是Comet(服务器推送)和相关连的Ajax支持。 | ||
本页包含了一个多人聊天室应用,当任何人发送聊天消息时,会以Comet更新浏览器。 | ||
用户可以通过页面的输入框发送一行信息到聊天室,信息会以异步请求的方式发送到服务器(页面在请求的时候不会重新加载)。 | ||
</big> | ||
</big> | ||
</p> | ||
|
||
<div style="margin: 12px; border: 2px solid purple"> | ||
<ul class="lift:comet?type=Chat"> | ||
<li>Line 1</li> | ||
<li class="clearable">Line 2</li> | ||
<li class="clearable">Line 3</li> | ||
</ul> | ||
|
||
<form class="lift:Form.ajax"> | ||
<input class="lift:ChatIn" id="chat_in"> | ||
<input type="submit" value="Chat"> | ||
</form> | ||
</div> | ||
|
||
<big> | ||
<big> | ||
让我们看看应用的Comet(服务器推送聊天内容列表)部分的标记代码: | ||
</big> | ||
</big> | ||
<pre class="lift:ShowCode?name=/comet.html;start=ul+;end=form">view code</pre> | ||
|
||
<div> | ||
<big> | ||
<big> | ||
我们只是简单的标记<ul>标签为一个snippet调用,用来载入名为<tt>Chat</tt>的Comet组件。 | ||
让我们看看<tt>Chat</tt>组件。 | ||
</big> | ||
</big> | ||
</div> | ||
|
||
<pre class="lift:ShowCode?name=/net/liftweb/seventhings/comet/Chat.scala;start=**;end=**">view code</pre> | ||
|
||
|
||
<div> | ||
<big> | ||
<big> | ||
再次证明,对于其他框架来说很难或者根本不可能的事情,对于Lift来说小菜一碟。 | ||
开发人员不用管浏览器是如何轮询(poll)最新的变化。 | ||
Lift默认使用long polling和合并多个comet组件到一个单独的long poll,Lift将会自动支持这些功能而不影响你写的代码。 | ||
开发人员只用管“什么时候服务器端发生变化了,就更新组件”,Lift来完成剩下的工作。 | ||
</big> | ||
</big> | ||
</div> | ||
|
||
<br> | ||
|
||
<div> | ||
<big> | ||
<big> | ||
请注意,你可以试试用<a href="http://en.wikipedia.org/wiki/Cross-site_scripting">cross site scripting</a>攻击来攻击本网站(例如,在聊天输入框输入<tt><script>alert('我黑了你的机器')</script></tt>)。 | ||
你会发现在开发者没有做任何事情的情况下,Lift正确的转码了你输入的东西。 | ||
</big> | ||
</big> | ||
</div> | ||
|
||
<br> | ||
|
||
<div> | ||
<big> | ||
<big> | ||
让我们来看看关于Ajax输入表单的标记代码: | ||
</big> | ||
</big> | ||
</div> | ||
|
||
<pre class="lift:ShowCode?name=/comet.html;start=form;end=div">view code</pre> | ||
|
||
<div> | ||
<big> | ||
<big> | ||
我们用<tt>Form.ajax</tt> snippet来指示这个<tt>form</tt>是一个Ajax表单。 | ||
文本输入触发<tt>ChatIn</tt> snippet。 | ||
来看看这个snippet: | ||
</big> | ||
</big> | ||
</div> | ||
|
||
<pre class="lift:ShowCode?name=/net/liftweb/seventhings/snippet/ChatIn.scala;start=**">view code</pre> | ||
|
||
<div> | ||
<big> | ||
<big> | ||
再次表明,我们不许要任何深入研究。 | ||
Lift负责行为(发送输入的<tt>String</tt>到<tt>ChatServer</tt>。)的关联。 | ||
我们没有设置routes或任何其他东西。 | ||
甚至这段代码可以抵抗replay攻击,因为这个自动生成的routes是动态、随机和不可预测的。 | ||
当你想用标准的REST访问来完成任务的时候,Lift提供<a href="http://www.assembla.com/wiki/show/liftweb/REST_Web_Services">非常棒的REST支持</a>。 | ||
并且Lift支持数据或者HTML的Comet,所以你可也用Lift作为<a href="http://frothy.liftweb.net/capp">Cappuccino</a>、SproutCore、ExtJS等应用的服务端,并获得全面的Comet支持。 | ||
</big> | ||
</big> | ||
</div> | ||
|
||
|
||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<!DOCTYPE html> | ||
<html><head> | ||
|
||
<meta content="text/html; charset=UTF-8" http-equiv="content-type"> | ||
<title>Home</title> | ||
|
||
|
||
</head><body class="lift:content_id=main"> | ||
<div id="main" class="lift:surround?with=default;at=content"> | ||
<p><big><big> | ||
Lift是现今最强大,最安全的网页框架。 | ||
嗯,这样说有点嚣张,但是本网站会展示Lift的七种武器,别的框架很难或者根本不可能提供这些功能。 | ||
这七种武器是创建和维护高互动、安全网站的关键。 | ||
在相应页面里你可以看到使用七种武器的源代码。 | ||
你会明白Lift的不同之处以及为什么这样会更好。 | ||
</big></big></p> | ||
<ol> | ||
<li><big><span class="lift:Menu.item?name=lazy">延迟加载</span></big></li> | ||
<li><big class="lift:Menu.item?name=parallel">页面并行渲染</big></li> | ||
<li><big class="lift:Menu.item?name=comet">Comet与Ajax</big></li> | ||
<li><big><span class="lift:Menu.item?name=wiring">Wiring</span> -- 申明页面元素之间的相互依赖关系</big></li> | ||
<li><big class="lift:Menu.item?name=templates">设计友好的模板系统</big></li> | ||
<li><big><span class="lift:Menu.item?name=wizard">向导组件</span> -- 多页面输入,支持返回按钮</big></li> | ||
<li><big class="lift:Menu.item?name=security">安全性</big><br> | ||
</li> | ||
</ol> | ||
<big><big> | ||
Lift给你以上的七种武器,并且你的代码将非常简洁和易于维护,还有Lift的<a href="http://lift.la/lift-state-and-scaling">高性能和可扩展性</a>,你还可以将你的应用部署到非常成熟的J/EE基础之上并获得所有J/EE的好处。 | ||
</big></big> | ||
</div> | ||
|
||
</body></html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta content="text/html; charset=UTF-8" http-equiv="content-type"> | ||
<title>Lazy</title> | ||
</head> | ||
<body class="lift:content_id=main"> | ||
<div id="main" class="lift:surround?with=default;at=content"> | ||
<p><big><big>Lift内建支持延迟加载。</big></big></p> | ||
<p> | ||
</p> | ||
<div class="lift:LazyLoad"> | ||
<span class="lift:LongTime"> 计算开始于 | ||
<span id="start">start</span> ,结束于 <span id="end"></span>。 | ||
</span> | ||
</div> | ||
<big><big>注意到文字上面的图标了吗? 那个图标表示正在计算中。 | ||
浏览器首先渲染了页面,当页面中需要计算的部分计算完成时,相关HTML代码会发送给浏览器。 | ||
并且一个页面可以包含多个延迟加载控件: </big></big><br> | ||
<div class="lift:LazyLoad"> | ||
<div class="lift:LongTime"> 计算开始于 <span id="start">start</span> ,结束于 <span id="end"></span>。 </div> | ||
</div> | ||
<div> | ||
<big><big>会不会很难实现呢?下面就是显示部分的代码:</big></big><br> | ||
</div> | ||
<pre class="lift:ShowCode?name=/lazy.html;start=LazyLoad;end=big">view code</pre> | ||
|
||
<div> | ||
<big> | ||
<big> | ||
只有一点点的标记代码。 | ||
它只是标记了这个块将需要长时间计算。 | ||
Lift帮你完成剩下的工作。 | ||
让我们来看看<a href="http://stable.simply.liftweb.net/#sec:Snippets">snippet</a>代码: | ||
</big> | ||
</big> | ||
</div> | ||
|
||
<pre class="lift:ShowCode?name=/net/liftweb/seventhings/snippet/LongTime.scala;start=**">view code</pre> | ||
|
||
|
||
<div> | ||
<big> | ||
<big> | ||
大部分框架的核心不提供延迟加载功能。 | ||
这个功能一般很难实现,但是Lift有非常棒的<span class="lift:Menu.item?name=comet">comet</span>支持,所以可以很容易的从服务器“推送(push)”内容到浏览器。 | ||
</big> | ||
</big> | ||
</div> | ||
|
||
|
||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta content="text/html; charset=UTF-8" http-equiv="content-type"> | ||
<title>Parallel</title> | ||
</head> | ||
<body class="lift:content_id=main"> | ||
<div id="main" class="lift:surround?with=default;at=content"> | ||
<p> | ||
<big> | ||
<big> | ||
Lift可以让页面并行渲染。 | ||
当你渲染页面的时候需要从其他外部服务器获取信息的时候,这个功能非常有用。 | ||
当你必须连接10个不同的广告服务器,每个连接需要半秒钟响应,你就能体会到并行执行的优势了: | ||
</big> | ||
</big> | ||
</p> | ||
|
||
<div class="lift:FetchAd?parallel=true" | ||
style="margin: 12px; border: 1px solid blue"> | ||
广告服务器 #1: <span class="ad">The Ad</span> | ||
</div> | ||
|
||
<div class="lift:FetchAd?parallel=true" style="margin: 12px; border: 1px solid blue"> | ||
广告服务器 #2: <span class="ad">The Ad</span> | ||
</div> | ||
|
||
<div class="lift:FetchAd?parallel=true" style="margin: 12px; border: 1px solid blue"> | ||
广告服务器 #3: <span class="ad">The Ad</span> | ||
</div> | ||
|
||
<div class="lift:FetchAd?parallel=true" style="margin: 12px; border: 1px solid blue"> | ||
广告服务器 #4: <span class="ad">The Ad</span> | ||
</div> | ||
|
||
<div class="lift:FetchAd?parallel=true" style="margin: 12px; border: 1px solid blue"> | ||
广告服务器 #5: <span class="ad">The Ad</span> | ||
</div> | ||
|
||
<div class="lift:FetchAd?parallel=true" style="margin: 12px; border: 1px solid blue"> | ||
广告服务器 #6: <span class="ad">The Ad</span> | ||
</div> | ||
|
||
<div class="lift:FetchAd?parallel=true" style="margin: 12px; border: 1px solid blue"> | ||
广告服务器 #7: <span class="ad">The Ad</span> | ||
</div> | ||
|
||
<div class="lift:FetchAd?parallel=true" style="margin: 12px; border: 1px solid blue"> | ||
广告服务器 #8: <span class="ad">The Ad</span> | ||
</div> | ||
|
||
<div class="lift:FetchAd?parallel=true" style="margin: 12px; border: 1px solid blue"> | ||
广告服务器 #9: <span class="ad">The Ad</span> | ||
</div> | ||
|
||
<div class="lift:FetchAd?parallel=true" style="margin: 12px; border: 1px solid blue"> | ||
广告服务器 #10: <span class="ad">The Ad</span> | ||
</div> | ||
|
||
|
||
<big> | ||
<big> | ||
标记代码部分非常简单: | ||
</big> | ||
</big> | ||
<pre class="lift:ShowCode?name=/parallel.html;start=FetchAd;end=FetchAd">view code</pre> | ||
|
||
<div> | ||
<big> | ||
<big> | ||
只有一点点的标记代码。 | ||
当你将一个片段标记为<tt>parallel</tt>,Lift将这个片段的计算交给线程池里的其他线程。 | ||
同时,Lift继续计算页面的其他部分,并将最后的计算结果组合起来,再将组合后的页面发送给浏览器。 | ||
让我们来看看<a href="http://stable.simply.liftweb.net/#sec:Snippets">snippet</a>代码: | ||
</big> | ||
</big> | ||
</div> | ||
|
||
<pre class="lift:ShowCode?name=/net/liftweb/seventhings/snippet/FetchAd.scala;start=**">view code</pre> | ||
|
||
|
||
<div> | ||
<big> | ||
<big> | ||
再次证明,对于其他框架来说很难或者根本不可能的事情,对于Lift来说小菜一碟。 | ||
这个武器有多厉害? | ||
你的页面是否因为在生成页面的时候需要访问很多很多的后台服务而减慢页面的加载速度? | ||
Lift可以让它们并行执行。 | ||
</big> | ||
</big> | ||
</div> | ||
|
||
|
||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta content="text/html; charset=UTF-8" http-equiv="content-type"> | ||
<title>Security</title> | ||
</head> | ||
<body class="lift:content_id=main"> | ||
<div id="main" class="lift:surround?with=default;at=content"> | ||
<div> | ||
<big> | ||
<big> | ||
基于Lift的网页应用已经包含了很多的安全性设计。 | ||
Lift应用可以防御多种常见的安全性漏洞。 | ||
</big> | ||
</big> | ||
</div> | ||
|
||
<div> | ||
<big> | ||
<big> | ||
这里是Lift内置的安全保障来对付大部分的<a href="http://www.owasp.org/index.php/Top_10_2010-Main">OWASP Top 10</a>漏洞: | ||
<ul> | ||
<li>A1: 注入 - Lift的Mapper和Record会在将query string发送到后台数据库之前。</li> | ||
<li>A2: XSS - 在整个页面渲染周期中,Lift一直将页面视为DOM,直到最后的阶段。 | ||
这就让Lift可以在把页面发送浏览器之前自动转码Stings。</li> | ||
<li>A3: Session管理 - Lift使用J/EE container的session管理机制,允许登录的时候创建新session,并且保证所有密码全程都是安全编码过的。</li> | ||
<li>A4: 直接对象引用 - Lift表单不会暴露直接对象引用,对象只是保存在服务器端,并发布一个关于特定session的token来引用对象。</li> | ||
<li>A5: CSRF - Lift利用特定session的绑定来绑定HTML元素与这个元素的服务器端的行为。 | ||
绑定是不可预测的,所以不可能用Cross Site请求来调用特定session的绑定。</li> | ||
<li>A8: URL Access - Lift包含<a href="http://www.assembla.com/wiki/show/liftweb/SiteMap">SiteMap</a>机制,它为应用的URL可访问性提供定义规则。 | ||
SiteMap会拒绝访问URL除非满足特殊URL的访问标准。</li> | ||
</ul> | ||
</big> | ||
</big> | ||
</div> | ||
|
||
<div> | ||
<big> | ||
<big> | ||
因为Lift应用在默认情况下就有更强的安全性,开发者只用将精力放在功能上而不是写一些<i>ad hoc</i>的防御代码来对付OWASP Top 10还有其他的漏洞。 | ||
</big> | ||
</big> | ||
</div> | ||
|
||
</div> | ||
</body> | ||
</html> |
Oops, something went wrong.