Restlet框架解读-2
1)代码结构
Restlet目前有三个分子版本,1.1.X,2.0.X,2.1.X,2.1.X是开发主干,有很多新的特性在添加和修改,本文主要解读2.0.X这个版本,同时会涉及到1.1.X的部分内容。
下载完restlet代码后,可以看到如下的目录结构
/+ org.restlet.* (restlet API)
+ org.restlet.engine.* (restlet的一个默认实现)
+ org.restlet.example.*
+ org.restlet.ext.*
+ org.restlet.test.*
restlet是一款高度插件式的框架,ext包下面主要是restlet的扩展插件。
org.restlet下面主要是restlet的核心API和默认实现的引擎。
2)核心包结果
restlet是构建http协议之上的,按照http://roy.gbiv.com/pubs/dissertation/rest_arch_style.htm实现,所以在restlet的API中很多类名都是完全按照论文所提到的概念来设计。
核心API主要分为以下一个包:
详细的API说明可以查看http://wiki.restlet.org/docs_2.0/13-restlet/27-restlet.html
目前对restlet框架的代码结构有了一个简单的认识后,我们来看看restlet到底做了哪些工作。
restlet就是实现了HTTP协议下对一个URL资源的访问,所以restlet必然要实现HTTP协议,然后将请求路由到指定的处理类上,过程就这么简单,现在我们就来看看核心API,这里需要引入大师的文字:
Uniform REST interface. “The central feature that distinguishes the REST
* architectural style from other network-based styles is its emphasis on a
* uniform interface between components. By applying the software engineering
* principle of generality to the component interface, the overall system
* architecture is simplified and the visibility of interactions is improved.
* Implementations are decoupled from the services they provide, which
* encourages independent evolvability.” Roy T. Fielding
大概意思就是说明:REST架构区别与其他基于网络的软件架构最重要的特点就是REST强调组件之间接口统一。
所以在restlet核心API中所有的类都继承org.restlet.Uniform这个接口。
建议继续学习:
扫一扫订阅我的微信号:IT技术博客大学习
- 作者:xiaog 来源: xiaog's blog
- 标签: Restlet
- 发布时间:2011-07-18 12:27:35
-
[59] memory prefetch浅析
-
[55] 转载:cassandra读写性能原理分析
-
[50] 深入浅出cassandra 4 数据一致性问
-
[46] MySQL半同步存在的问题
-
[41] 获取Dom元素的X/Y坐标
-
[41] 《web前端最佳实践》—高维护性css
-
[39] javascript插入样式
-
[37] MySQL vs NoSQL 效率与成本之争
-
[37] 字符引用和空白字符
-
[36] 基本排序算法的PHP实现