axis2-handler and phase
来源:互联网 发布:淘宝怎么开虚拟商品 编辑:程序博客网 时间:2024/06/08 02:23
在Axis中handler是没有状态的,也就是说它不会把执行状态保存到内存中。我们可以把MessageContext理解为保存了进出消息的bag,在执行的链上它也可能保存一些信息。
在大部分情况下,一个handler只会touchesoap消息的header block。
一个继承AbstractHandler的类如下:
public class SimpleHandler extends AbstractHandler{public SimpleHandler(){}public InvocationResponse invoke(MessageContext msgContext)throws AxisFault {//Write the processing logic here// DO somethingreturn InvocationResponse.CONTINUE;}}
在Axis2中有两个phase:(1)Global phase(2)Operation Phase
global phase
当一个消息进入系统后,它会进入global phase,global phase定义在axis2.xml文件中。
<phaseOrder type="InFlow"> <!-- System predefined phases --> <phase name="Transport"> <handler name="RequestURIBasedDispatcher" class="org.apache.axis2.engine.RequestURIBasedDispatcher"> <order phase="Transport"/> </handler> <handler name="SOAPActionBasedDispatcher" class="org.apache.axis2.engine.SOAPActionBasedDispatcher"> <order phase="Transport"/> </handler></phase><phase name="Security"/><phase name="PreDispatch"/><phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase"> <handler name="RequestURIBasedDispatcher" class="org.apache.axis2.engine.RequestURIBasedDispatcher"/> <handler name="SOAPActionBasedDispatcher" class="org.apache.axis2.engine.SOAPActionBasedDispatcher"/> <handler name="AddressingBasedDispatcher" class="org.apache.axis2.engine.AddressingBasedDispatcher"/> <handler name="RequestURIOperationDispatcher" class="org.apache.axis2.engine.RequestURIOperationDispatcher"/> <handler name="SOAPMessageBodyBasedDispatcher" class="org.apache.axis2.engine.SOAPMessageBodyBasedDispatcher"/> <handler name="HTTPLocationBasedDispatcher" class="org.apache.axis2.engine.HTTPLocationBasedDispatcher"/></phase> <!-- System predefined phases --> <!-- After Postdispatch phase module author or service author can add any phase he or she wants --> <phase name="OperationInPhase"/> <phase name="soapmonitorPhase"/></phaseOrder>
在上面,Transport, Security, PreDispatch和Dispatch都是global phases,而OperationInPhase和soapmonitorPhase是Operation-specific phase。global phases都可以听名而知其意,Transport phases包含的handler依赖于transport类型,Security phase,WS-Security 实现会包括他们的handlers。PreDispatch phase会包含一些handler来做一些dispatch之前的工作,有一些handler如WS-Addressing,总会包含在这个phase中。Dispatch phase分行消息分发工作。
Operation Phase
有一些消息希望只被一些operations处理,phase rule的主要思想是正确定位一个handler,定制一个phase rule可以使用下面向个属性:
(1)Phase name
这是一个必备的属性。
(2)Phase first
如果我们想让一个handler是一个phase中第一个执行的,需要在handler的属性中添加phaseFirst="true"
<handler name="simple_Handler " class="org.apache.axis.handlers.SimpleHandler "> <order phase="userphase1" phaseFirst="true"/> </handler>
(3)Phase Last(同phase fisrt)
(4)Before
通过这个属性,可以让一个handler在另一个handler之前执行。
<handler name="simple_Handler2 " class="org.apache.axis.handlers.SimpleHandler2 "> <order phase="userphase1" before=" simple_Handler "/> </handler>
(5)After
(6)Before and after
Flow是一组phases的集合,在Axis2中有四种类型的flows。
(1)InFlow
当请求消息过来时,会经过InFlow。
(2)OutFlow
当返回客户端响应时。
(3)InFaultFlow
当请求发生错误时会激活它。
(4)OutFaultFlow
- axis2-handler and phase
- Group delay and phase delay
- Group Delay and Phase Delay
- nginx phase handler的原理和选择
- nginx phase handler的原理和选择
- js执行顺序(Compile phase and execute phase)
- Adding a handler in AXIS2
- Spark and Tez, out of phase
- time-lock and phase-lock signal
- Axis2 and java5 annotations
- Axis2 sample and asynchronize
- nginx源码分析(8)——phase handler处理
- axis and axis2 version history
- Axis2 and CXF的比较
- Axis2 and CXF的比较
- Maven中的几个重要概念(二):lifecycle, phase and goal
- Maven中的几个重要概念(二):lifecycle, phase and goal
- Reduction to two dimensions and Phase plane analysis
- WebGL笔记 第二章入门
- liteOrm数据库管理方法
- Oracle数据库、实例、用户、表空间、表之间的关系
- tcp/ip 上,丢包重传机制
- 10min实现一个简易网站源码查看器(HttpURLConnection、ScrollView)
- axis2-handler and phase
- SAP SMP 3.0 SDK kepsel logon登录界面引用其他页面
- js 拼接 当前系统时间 动态提交表单!
- BZOJ 4665: 小w的喜糖【dp,容斥
- Android发布app时,icon和设置的不一致
- jquery的$.alerts.alert怎么实现点击后跳转页面
- Leetcode 383 Ransom Note
- 在word里添加mathtype选项
- iOS iO10 调取本地相册,相机