SpringExt

自定义Spring Schema的例子

基于Spring可扩展Schema提供自定义配置支持

使用SpringExt扩展Webx的示例

扩展点和捐献

一个namespace下可以声明多个element。

扩展点:将namespace和接口关联起来。
捐献:将element和实现关联起来。

webx archetype

tutorial1

tutorial11.PNG
mvn archetype:generate -DgroupId=com.alibaba.webx -DartifactId=tutorial1 -Dversion=1.0-SNAPSHOT -Dpackage=com.alibaba.webx.tutorial1 -DarchetypeArtifactId=archetype-webx-quickstart -DarchetypeGroupId=com.alibaba.citrus.sample -DarchetypeVersion=1.8 -DinteractiveMode=false

login-webx3-tutorial

该示例是tutorial1示例中的“5. Form Validation”部分的内容。

login-webx3-tutorial.PNG
mvn archetype:generate -DgroupId=com.alibaba.webx -DartifactId=login-webx3-tutorial -Dversion=1.0-SNAPSHOT -Dpackage=com.alibaba.webx.tutorial -DarchetypeArtifactId=archetype-webx-quickstart -DarchetypeGroupId=com.alibaba.citrus.sample -DinteractiveMode=false

petstore

git clone https://github.com/webx/citrus-sample.git
cd citrus-sample/petstore
mvn clean install
cd web
mvn jetty:run-war

第五章

web应用根目录
就是指的是web项目的根目录。
/WEB-INF/web.xml
上述的/不是相对于操作系统而言,而是针对web项目而言。

charset

每一端都有input chaset 和output charset。这就好比socket通信,每一端都有输入流和输出流。

如何将url转为target

AnalyzeURLValve:取得target,action,actionEvent。
(1)通过request.getServletPath()+request.getPathInfo()获取请求的pathInfo,并通过MappingRuleService将pathInfo转为target。
(2)取得请求中的action参数。通过MappingRuleService得到最后的action。
(3)得到请求中的actionEvent。

对开发者的要求:
(1)配置MappingRuleService的映射规则。即<services:mapping-rules>

如何将target映射到action

PerformActionValve:根据action参数找到具体的action类,然后执行其execute()方法。
ModuleLoaderService.getModule(action).execute()
Module就是一个含execute()方法的接口。

<direct-module-rule>元素表示直接映射module,这是最简单的模块映射规则。
它映射Module的原理是:将URL路径"/"替换成".",除去文件名后缀,将最后一个单词首字母改成大写,以符合模块命名的规则。
比如http://abc.com/helloapp/path/hello.htm

webx根据你访问的URL target “path/hello.htm”,定位到 Module “path.hello.class”

    <services:module-loader>
<ml-factories:class-modules>
<search-packages type="$1" packages="com.alibaba.sample.petstore.web.common.module.*" />
</ml-factories:class-modules>
</services:module-loader>

webx相关blog

petstore-web的src目录如下:

src
└─main
├─java
│ └─com
│ └─alibaba
│ └─sample
│ └─petstore
│ └─web
│ ├─common
│ │ └─util
│ ├─home
│ │ └─module
│ │ └─screen
│ ├─servlet
│ ├─store
│ │ └─module
│ │ ├─action
│ │ ├─control
│ │ └─screen
│ └─user
│ └─module
│ ├─action
│ └─screen
└─webapp
├─common
│ └─templates
│ ├─layout
│ └─screen
├─home
│ ├─css
│ ├─images
│ └─templates
│ ├─control
│ ├─layout
│ └─screen
├─META-INF
│ └─autoconf
├─store
│ ├─css
│ ├─images
│ └─templates
│ ├─control
│ ├─layout
│ └─screen
│ └─edit
├─user
│ ├─css
│ └─templates
│ ├─control
│ ├─layout
│ └─screen
└─WEB-INF
├─common
│ └─$petstore_upload
├─home
├─store
└─user

WEB-INF目录

main下的两个目录分别是java和webapp。

从代码结构来看,整个petstore-web分成了3个模块(子应用),分别是home、user、store等3个模块。另外还有一个公共模块common。

java部分

java部分在com.alibaba.sample.petstore.web下有四个主要的子包common、home、user、store,分别对应4个模块。
然后在每个子包下面才是action、control、screen等module。

com.alibaba.sample.petstore.web.子模块.module.action.LoginAction;
com.alibaba.sample.petstore.web.子模块.module.screen.LoginAction;
com.alibaba.sample.petstore.web.子模块.module.control.LoginAction;

webapp部分

webapp目录下有4个子模块目录和WEB-INF目录。
四个子模块目录分别是common、home、user、store。每个里面都是存放的该模块的css、img、template等资源。

WEB-INF目录下的内容:

  • web.xml
  • 3个子模块目录(每个里面都是form.xml),每个子模块对应一个webx-*.xml
  • 公共子目录common,里面存放了共用的配置文件;以及一个总的webx.xml

每个子模块的webx-*.xml中都有一个装载模块的配置<services:module-loader>,对应着java中的package。

例如webx-home.xml中的配置片段是:<search-packages type="$1" packages="com.alibaba.sample.petstore.web.home.module.*" />
例如webx-user.xml中的配置片段是:<search-packages type="$1" packages="com.alibaba

webx roadmap的更多相关文章

  1. (转载)The One Sign You Will Be Rich-(by Brian de Haaff Founder and CEO Aha! -- world's #1 product roadmap software)

    When I was studying Philosophy at Berkeley, a friend told me that she could tell who was going to be ...

  2. 阿里巴巴开源技术 WebX

    0. WebX项目目前已开源, 项目开源地址:https://github.com/webx/citrus-sample.git 项目参考文档:http://www.openwebx.org/docs ...

  3. 深入webx框架(li)

    目录 1.Webx简介 2.创建webx应用   一.Webx简介 Webx本质上就是一个Web框架,它建立在Java Servlet API基础之上.上图所示是webx的架构图.webx本身类似于s ...

  4. Deep Learning Papers Reading Roadmap

    Deep Learning Papers Reading Roadmap https://github.com/songrotek/Deep-Learning-Papers-Reading-Roadm ...

  5. 2016年 Delphi Roadmap

    2016年delphi Roadmap 发布,这也是新公司的第一次发布路线图. 虽然稍微晚点( 原来说是1月份发布路线图),至少比过去积极点.喧嚣多年的靴子终于落地. Linux 的支持终于正式公布. ...

  6. .NET Core Roadmap

    This post was written by Scott Hunter. It has been about two weeks since we shipped .NET Core / ASP. ...

  7. gRPC 的 RoadMap 20160325 更新

    gRPC是一个高性能.通用的开源RPC框架,其由Google主要面向移动应用开发并基于HTTP/2协议标准而设计,基于ProtoBuf(Protocol Buffers)序列化协议开发,且支持众多开发 ...

  8. 我的WebX框架学习总结与心得分享

    最近学习了webx框架, 利用博客园跟大家分享一下自己的学习心得; 周建旭 2014-08-21 网上关于webx的资料少的可怜, 怎么办?  这种情况下不用去求助别人求人只会耽误时间, 不用畏惧; ...

  9. Webx常用接口

    最近在学Webx框架, 在了解webx的工作流程后, 必须要会使用自带的接口和类 常用的 Navigator  这个接口中只有两种类型的方法, 及重定向与转发, 一般用在screen包下的类(注意:s ...

随机推荐

  1. 一个简单的Oracle和 SQLSERVER 重建所有表索引的办法

    1. SQLSERVER 使用微软自带的存储过程 exec sp_msforeachtable 'DBCC DBREINDEX(''?'')' 2. Oracle的办法: select 'alter ...

  2. GS使用HTTPS登录的设置过程

    1. Windows 增加角色服务 服务器配置管理器, 添加角色服务 增加角色功能里面有: 证书颁发机构 证书颁发机构 web注册 2. AD CS配置 主要是next操作 独立ca 根证书 等 3. ...

  3. PP学习笔记02

    SPRO SAP参考IMG MM03 物料视图 生产计划编制 需求管理 已计划的独立需求 需求类型 策略组 定义策略 策略组 主要策略(独立需求 ) 客户需求类型 需求类 (计划标识符.消耗标识.需求 ...

  4. 借鉴 学习 DELPHI 通用函数 哈哈

    [转]关于Delphi通用涵数 http://m.blog.csdn.net/blog/dragonjiang5460/1196927 2006-9-8阅读2016 评论0 DELPHI程序注册码设计 ...

  5. BZOJ2863[SHOI2012]魔法树——树链剖分+线段树

    题目描述 输入 输出 样例输入 4 0 1 1 2 2 3 4 Add 1 3 1 Query 0 Query 1 Query 2 样例输出 3 3 2   树链剖分模板题,路径修改子树查询,注意节点 ...

  6. .net event 使用 Action

    Action<string> methodCall = (x) => { x += "haha"; MessageBox.Show(x); }; public e ...

  7. Spring的编程式事务和声明式事务

    事务管理对于企业应用来说是至关重要的,当出现异常情况时,它也可以保证数据的一致性. Spring事务管理的两种方式 spring支持编程式事务管理和声明式事务管理两种方式. 编程式事务使用Transa ...

  8. poj1068 【模拟】

    Let S = s1 s2...s2n be a well-formed string of parentheses. S can be encoded in two different ways:  ...

  9. MT【209】打破对称

    设正数$a,b,c$满足$ab+bc+ca=47$,求$(a^2+5)(b^2+5)(c^2+5)$的最小值_____ 解:$(a^2+5)(b^2+5)(c^2+5)=(a^2+5)(5(b+c)^ ...

  10. MT【43】抛物线不常见性质2.

    注:S为抛物线焦点