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. 传输层中的协议 TCP & UDP

    面向连接的TCP协议 “面向连接”就是在正式通信前必须要与对方建立起连接.比如你给别人打电话,必须等线路接通了.对方拿起话筒才能相互通话.TCP(Transmission Control Protoc ...

  2. Node require

    var user = require("./module_user");//使用模块 module_userconsole.log(user.userCount);user.use ...

  3. poj 3352 Road Construction(边双连通分量+缩点)

    题目链接:http://poj.org/problem?id=3352 这题和poj 3177 一样,参考http://www.cnblogs.com/frog112111/p/3367039.htm ...

  4. 热修改 MySQL 数据库 pt-online-schema-change 的使用详解

    由于周五公司团建的关系所以此篇推迟了抱歉. 首先不得不在该篇里面梳理一个数据库热增加删除字段表的工具 pt-online-schema-change 这个工具在前面我的博文 <关于utf8mb4 ...

  5. QueryParser 是对一段话进行分词的 用于收集客户端发来的

  6. GO系列教程

    1.介绍与安装 2.Hello World 3.变量 4. 类型 5.常量 6.函数(Function) 7.包 8.if-else 语句 9.循环 10.switch语句 11.数组和切片 12.可 ...

  7. 【 Gym - 101138K 】 The World of Trains (DP)

    BUPT2017 wintertraining(15) #4E Gym - 101138K 题意 N节车厢的火车,每节车厢容量是1~K,那么有\(K^N\)种火车. 求选择D个连续的且容量相同的车厢的 ...

  8. 【BZOJ2426】[HAOI2010]工厂选址(贪心)

    [BZOJ2426][HAOI2010]工厂选址(贪心) 题面 BZOJ 洛谷 题解 首先看懂题目到底在做什么. 然而发现我们显然可以对于每个备选位置跑一遍费用流,然后并不够优秀. 不难发现所有的位置 ...

  9. python开启httpserver服务在自动化测试中的一个小运用

    httpserver可以在本机启动一个python实现的web服务器,在自动化测试中,可以将生成测试报告的目录开放给项目组同事. 先安装python 自动化测试框架,生成报告的目录D:\Automat ...

  10. Nginx入门篇

    Nginx 是一个高性能的 Web 和反向代理服务器, 它具有有很多非常优越的特性: 作为 Web 服务器:相比 Apache,Nginx 使用更少的资源,支持更多的并发连接,体现更高的效率,这点使 ...