Cetia4 1.1文档-1引言

 1.引言

本文档一步一步的介绍了如何用cetia4 框架建立基于Rest的应用程序。

 

Cetia4使用一种简单但是有效的机制,这种机制可以非常简单的创建如下两种工作方式的基于java的应用:

1,  可以通过Web浏览器,或者其他有状态的基于Web的客户端程序访问的Web程序。或者是

2,  可以应答HTTP无状态的Rest方式的Web Services程序

 

Cetia4 使用了一些众所周知的模式来构建其基础架构。和其他很多的java框架一样,MVC模式是其架构的核心。Controller通过Servlets和帮助类实现,View通过典型的JSP页面实现(如果有必要的话其他的视图也将被支持),  Model的实现并不局限于某种框架-但是对于spring有一些便利的支持类。

cetia

 

Cetia4 还有一些和Jakarta  Strusts,OpenSymphony  WebWork类似的特性,比如:

●HTTP-to-java 类java-TO-HTTP的双向映射功能

● 验证功能

● 消息和错误报告功能

●国际化支持

●导航功能

●实用标签库,等等。

但是事实上Cetia4与那些框架典型的方式有着实质的不同,Cetia4的这些实现

支持REST的概念和哲学,因此围绕程序的一些方面与传统WEB 框架有着很大的区别。例如:应用设计,URL的映射方式,GET和POST方法的使用等等。

                    

Cetia4基于J2SE5.0,广泛使用在注释,泛型,变参以及其他一些新功能,这些功能在先前的Java Platform Standard Edition 是不存在的。Cetia4中的Web应用开发是基于J2EE 1.4 规范的(JavaServlets 2.4,JSP 2.0,JSTL 1.1)。规范提供的标准都是用在了需要的地方。这意味着Web容器必须支持1.4或者更高的版本,例如Tomcat 5.5.(参看:软件配置要求一节)

 

在这些版本中的新的功能使得可以省时,低代价的创建出功能强大的应用程序。

特别是J2SE5.0的注释机制对于Cetia4来说非常有帮助,它避免了过多依赖于外部的配置文件。J2EE的授权机制可能被使用。如果需要的话,用户定制的授权机制也可以使用(不推荐);框架提供了一些安全扩展来很好地处理REST的授权问题。

Cetia4 不支持1.4以前的标准规范。

 

在需要的地方,cetia4还使用了其他的开源库,因此它依赖一些Jakata 和Jakarta Commons工程。在任何情况下,这样类型的代码复用是非常有用的。Java

标准(例如:jstl,jsp,collections)等应该优先使用,但是在某些情况下,其他的类库可能更合适(jakarta commons logging 可以替代java.util.logging,为了可扩展的原因)。

Validation facilities were not implemented using existing approaches, such as Jakarta Commons Validator, in favor of a more codeoriented

and simpler alternative, at the expense of lacking client validation support in the current version. Pluggable server-side validation strategies are possible; and an implementation for Hibernate Validator is provided with version 1.1.

 

Cetia4 支持使用Get,post,put 和delete的方法http请求。在一般的的web环境中,put 和delete 方法并没有普遍的被支持(浏览器在form请求中并没有很好的处理他们 –我们希望这种状况会改变 当主流的浏览器支持Xfrom方法的实现)。所以Cetia4可以仅仅使用get和post方法实现所有的功能。Plain 和mutiform 都是被支持的,mutiform encoding 是通过jakarta 的 common file upload工程实现的。

Cetia4 可以简单方便的与其他通用的框架集成,例如:可以集成opensymphony的sitemesh控制页面布局,也可以集成spring+jdbc/hibernate等等。如果项目需要的话,还可以集成Ejb。Cetia4还提供了简单的xml客户端来执行项目测试功能(是jakarta commons httpClient 项目的简单的包装类)。

 

 实际上,应用集成是Soa架构的基础。Soa 是一种以Rest为单元的系统架构。

因此,cetia4 与apache 服务的集成是其基本的功能,同样的,cetia4与其他集成的实现也是基于同样的方法(毕竟,这是rest的主要目的,不是吗?)。

    在com.acsinet_solutions.cetia4.test 包中提供的回归测试使用了经典的Junit测试框架;Rest Servlets 的特性通过了spring framework mock object进行了测试。在这个包中的类也可以作为参考如果对莫个类用户有疑问的话。

 

 

 Cetia4 的参考文献和包介绍通过javadoc提供,可以在发布的二进制版本中找到;或者可以通过元代码中生成。

 

 Cetia4 是acsinet solutions 开发的,这是第四个版本,第一个版本可以追溯到 90s。

从那时起,它就被用在公司的项目中,这一个版本是框架的进化版本。

 

It has been used in the company's ( Acsinet  Solutions ) internal and external projects since then, and this version is the results of all

experiences and evolution both inside and outside the framework. The framework started (

Cetia or Cetia1 ) as a set of classes that implemented much of what J2EE has standarized

today - it used a template engine in a time where neither JSP or Velocity existed ( and

WebMacro was under GPL ) , an XML format that declared some facilities now present in

the standard web deployment descriptor file, and lots of libraries that resemble some of the

work that is now implemented by Spring Framework and similar alternatives. With time,

CetiaX evolved to a web framework that leverages standards and specialized open source

libraries when it makes sense to do so, and is now a stable framework that shares similar

characteristics to some of the main features of web frameworks like Jakarta Struts or

OpenSymphony WebWork. It does not currently try to compete with those approaches; it tries to provide a solid foundation for the need of a REST java-based framework; 

something that is currently outside of the scope of those projects.

A final note: some may notice that a lot of Cetia4 architecture resembles the standard

java portlet architecture; that is because the previous version of the framework ( Cetia3 )

used to work for both servlet and portlet environments ( though not in a REST fashion for

portlet environments ). Although portlet components live inside a portlet container and are

not REST based ( portlet URIs are implementation dependent ), Cetia3 abstractions were

very useful also in that type of environment. No portlet support is provided on Cetia4,

because Java Portlet 2 specification is still not final, and a previous version of the spec

does not support J2EE 1.4 facilities. In the future, when a standard Java Portlet 2

implementation is available that runs over J2SE 5.0, portlet support will be added back to

Cetia4 - the framework is ready for it.

 

转载于:https://my.oschina.net/abcijkxyz/blog/720881

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值