本文整理汇总了Java中org.apache.axis2.engine.Handler.init方法的典型用法代码示例。如果您正苦于以下问题:Java Handler.init方法的具体用法?Java Handler.init怎么用?Java Handler.init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.axis2.engine.Handler
的用法示例。
在下文中一共展示了Handler.init方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addHandler
import org.apache.axis2.engine.Handler; //导入方法依赖的package包/类
public static void addHandler(Flow flow, Handler handler, String phaseName) {
HandlerDescription handlerDesc = new HandlerDescription(handler.getName());
PhaseRule rule = new PhaseRule(phaseName);
handlerDesc.setRules(rule);
handler.init(handlerDesc);
handlerDesc.setHandler(handler);
flow.addHandler(handlerDesc);
}
示例2: testPhaseFirst
import org.apache.axis2.engine.Handler; //导入方法依赖的package包/类
public void testPhaseFirst() throws AxisFault {
ArrayList phases = new ArrayList();
Phase p1 = new Phase("PhaseA");
phases.add(p1);
Phase p2 = new Phase("PhaseB");
phases.add(p2);
PhaseHolder ph = new PhaseHolder(phases);
HandlerDescription hm = new HandlerDescription();
hm.setClassName("org.apache.axis2.phaserule.PhaseRuleHandler");
Handler h1 = new PhaseRuleHandler();
h1.init(hm);
((PhaseRuleHandler) h1).setName("PhaseFirstHandler");
hm.setHandler(h1);
hm.setName("H1");
PhaseRule rule = new PhaseRule();
rule.setPhaseName("PhaseA");
rule.setPhaseFirst(true);
hm.setRules(rule);
ph.addHandler(hm);
HandlerDescription hm1 = new HandlerDescription();
hm1.setClassName("org.apache.axis2.phaserule.PhaseRuleHandler");
Handler h2 = new PhaseRuleHandler();
((PhaseRuleHandler) h2).setName("Second Handler");
h2.init(hm1);
hm1.setHandler(h2);
hm1.setName("H2");
PhaseRule rule1 = new PhaseRule();
rule1.setPhaseName("PhaseA");
rule1.setBefore("H1");
hm1.setRules(rule1);
try {
ph.addHandler(hm1);
} catch (PhaseException e) {
return;
}
fail("Succeeded in deploying after PhaseFirst handler!");
}
示例3: testPhaseLast
import org.apache.axis2.engine.Handler; //导入方法依赖的package包/类
public void testPhaseLast() throws AxisFault {
ArrayList phases = new ArrayList();
Phase p1 = new Phase("PhaseA");
phases.add(p1);
Phase p2 = new Phase("PhaseB");
phases.add(p2);
PhaseHolder ph = new PhaseHolder(phases);
HandlerDescription hm = new HandlerDescription();
hm.setClassName("org.apache.axis2.phaserule.PhaseRuleHandler");
Handler h1 = new PhaseRuleHandler();
h1.init(hm);
((PhaseRuleHandler) h1).setName("PhaseLast");
hm.setHandler(h1);
hm.setName("H1");
PhaseRule rule = new PhaseRule();
rule.setPhaseName("PhaseA");
rule.setPhaseLast(true);
hm.setRules(rule);
ph.addHandler(hm);
HandlerDescription hm1 = new HandlerDescription();
hm1.setClassName("org.apache.axis2.phaserule.PhaseRuleHandler");
Handler h2 = new PhaseRuleHandler();
((PhaseRuleHandler) h2).setName("Second Handler");
h2.init(hm1);
hm1.setHandler(h2);
hm1.setName("H2");
PhaseRule rule1 = new PhaseRule();
rule1.setPhaseName("PhaseA");
rule1.setAfter("H1");
hm1.setRules(rule1);
try {
ph.addHandler(hm1);
} catch (PhaseException e) {
return;
}
fail("Succeeded in deploying after PhaseLast handler!");
}
示例4: testInvalidPhaseFirst
import org.apache.axis2.engine.Handler; //导入方法依赖的package包/类
public void testInvalidPhaseFirst() {
ArrayList phases = new ArrayList();
Phase p1 = new Phase("PhaseA");
phases.add(p1);
Phase p2 = new Phase("PhaseB");
phases.add(p2);
PhaseHolder ph = new PhaseHolder(phases);
HandlerDescription hm = new HandlerDescription();
hm.setClassName("org.apache.axis2.phaserule.PhaseRuleHandler");
Handler h1 = new PhaseRuleHandler();
h1.init(hm);
((PhaseRuleHandler) h1).setName("PhaseFirstHandler");
hm.setHandler(h1);
hm.setName("H1");
PhaseRule rule = new PhaseRule();
rule.setPhaseName("PhaseA");
rule.setPhaseFirst(true);
rule.setBefore("H2");
hm.setRules(rule);
try {
// This should fail
ph.addHandler(hm);
fail("Incorrectly added Handler with both PhaseFirst and before name");
} catch (PhaseException e) {
// Perfect, caught the expected Exception
}
}
示例5: testInvalidPhaseFirst1
import org.apache.axis2.engine.Handler; //导入方法依赖的package包/类
public void testInvalidPhaseFirst1() {
try {
ArrayList phases = new ArrayList();
Phase p1 = new Phase("PhaseA");
phases.add(p1);
Phase p2 = new Phase("PhaseB");
phases.add(p2);
PhaseHolder ph = new PhaseHolder(phases);
HandlerDescription hm = new HandlerDescription();
hm.setClassName("org.apache.axis2.phaserule.PhaseRuleHandler");
Handler h1 = new PhaseRuleHandler();
h1.init(hm);
((PhaseRuleHandler) h1).setName("PhaseFirstHandler");
hm.setHandler(h1);
hm.setName("H1");
PhaseRule rule = new PhaseRule();
rule.setPhaseName("PhaseA");
rule.setPhaseFirst(true);
hm.setRules(rule);
ph.addHandler(hm);
HandlerDescription hm1 = new HandlerDescription();
hm1.setClassName("org.apache.axis2.phaserule.PhaseRuleHandler");
Handler h2 = new PhaseRuleHandler();
((PhaseRuleHandler) h2).setName("Second Handler");
h2.init(hm1);
hm1.setHandler(h2);
hm1.setName("H2");
PhaseRule rule1 = new PhaseRule();
rule1.setPhaseName("PhaseA");
rule1.setPhaseFirst(true);
hm1.setRules(rule1);
ph.addHandler(hm1);
fail("This should be faild with PhaseFirst already has been set, cannot have two " +
"phaseFirst Handler for same phase ");
} catch (AxisFault axisFault) {
}
}
示例6: testPhaseLastErrors
import org.apache.axis2.engine.Handler; //导入方法依赖的package包/类
public void testPhaseLastErrors() throws Exception {
ArrayList phases = new ArrayList();
Phase p1 = new Phase("PhaseA");
phases.add(p1);
Phase p2 = new Phase("PhaseB");
phases.add(p2);
PhaseHolder ph = new PhaseHolder(phases);
HandlerDescription hm = new HandlerDescription();
hm.setClassName("org.apache.axis2.phaserule.PhaseRuleHandler");
Handler h1 = new PhaseRuleHandler();
h1.init(hm);
((PhaseRuleHandler) h1).setName("PhaseFirstHandler");
hm.setHandler(h1);
hm.setName("H1");
PhaseRule rule = new PhaseRule();
rule.setPhaseName("PhaseA");
rule.setPhaseLast(true);
rule.setBefore("H2");
hm.setRules(rule);
try {
ph.addHandler(hm);
} catch (PhaseException e) {
return;
}
fail("Handler with PhaseLast cannot also have before/after set");
}
示例7: testInvalidPhaseLast
import org.apache.axis2.engine.Handler; //导入方法依赖的package包/类
public void testInvalidPhaseLast() {
try {
ArrayList phases = new ArrayList();
Phase p1 = new Phase("PhaseA");
phases.add(p1);
Phase p2 = new Phase("PhaseB");
phases.add(p2);
PhaseHolder ph = new PhaseHolder(phases);
HandlerDescription hm = new HandlerDescription();
hm.setClassName("org.apache.axis2.phaserule.PhaseRuleHandler");
Handler h1 = new PhaseRuleHandler();
h1.init(hm);
((PhaseRuleHandler) h1).setName("PhaseLast");
hm.setHandler(h1);
hm.setName("H1");
PhaseRule rule = new PhaseRule();
rule.setPhaseName("PhaseA");
rule.setPhaseLast(true);
hm.setRules(rule);
ph.addHandler(hm);
HandlerDescription hm1 = new HandlerDescription();
hm1.setClassName("org.apache.axis2.phaserule.PhaseRuleHandler");
Handler h2 = new PhaseRuleHandler();
((PhaseRuleHandler) h2).setName("Second Handler");
h2.init(hm1);
hm1.setHandler(h2);
hm1.setName("H2");
PhaseRule rule1 = new PhaseRule();
rule1.setPhaseName("PhaseA");
rule1.setPhaseLast(true);
hm1.setRules(rule1);
ph.addHandler(hm1);
fail("This should be faild with Phaselast already has been set, cannot have two " +
"phaseLast Handler for same phase ");
} catch (AxisFault axisFault) {
}
}
示例8: testHandlers
import org.apache.axis2.engine.Handler; //导入方法依赖的package包/类
public void testHandlers() throws AxisFault {
Handler handler = new AbstractHandler() {
public InvocationResponse invoke(MessageContext msgContext) {
return InvocationResponse.CONTINUE;
}
};
handler.init(new HandlerDescription());
assertNull(handler.getName());
assertNull(handler.getParameter("hello"));
}
示例9: testPhaseRules
import org.apache.axis2.engine.Handler; //导入方法依赖的package包/类
public void testPhaseRules() throws Exception {
// TODO : What is this testing exactly?
List inPhase = new AxisConfiguration().getInFlowPhases();
Phase transportIN = new Phase("TransportIn");
Phase preDispatch = new Phase("PreDispatch");
DispatchPhase dispatchPhase = new DispatchPhase();
dispatchPhase.setName("Dispatch");
inPhase.add(transportIN);
inPhase.add(preDispatch);
inPhase.add(dispatchPhase);
PhaseHolder ph = new PhaseHolder(inPhase);
HandlerDescription hm = new HandlerDescription();
hm.setClassName("org.apache.axis2.phaserule.PhaseRuleHandler");
Handler h1 = new PhaseRuleHandler();
h1.init(hm);
hm.setHandler(h1);
hm.setName("H1");
PhaseRule rule = new PhaseRule();
rule.setPhaseName("PreDispatch");
rule.setPhaseFirst(true);
hm.setRules(rule);
ph.addHandler(hm);
HandlerDescription hm1 = new HandlerDescription();
hm1.setClassName("org.apache.axis2.phaserule.PhaseRuleHandler");
Handler h2 = new PhaseRuleHandler();
h2.init(hm1);
hm1.setHandler(h2);
hm1.setName("H2");
PhaseRule rule1 = new PhaseRule();
rule1.setPhaseName("PreDispatch");
rule1.setAfter("H1");
hm1.setRules(rule1);
ph.addHandler(hm1);
HandlerDescription hm2 = new HandlerDescription();
hm2.setClassName("org.apache.axis2.phaserule.PhaseRuleHandler");
Handler h3 = new PhaseRuleHandler();
h3.init(hm2);
hm2.setHandler(h3);
hm2.setName("H3");
PhaseRule rule2 = new PhaseRule();
rule2.setPhaseName("PreDispatch");
rule2.setAfter("H1");
rule2.setBefore("H2");
hm2.setRules(rule2);
ph.addHandler(hm2);
HandlerDescription hm3 = new HandlerDescription();
hm3.setClassName("org.apache.axis2.phaserule.PhaseRuleHandler");
Handler h4 = new PhaseRuleHandler();
h4.init(hm3);
hm3.setHandler(h4);
hm3.setName("H4");
PhaseRule rule3 = new PhaseRule();
rule3.setPhaseName("Dispatch");
hm3.setRules(rule3);
ph.addHandler(hm3);
}
示例10: testSingleHandler
import org.apache.axis2.engine.Handler; //导入方法依赖的package包/类
public void testSingleHandler() throws Exception {
ArrayList phases = new ArrayList();
Phase p1 = new Phase("PhaseA");
phases.add(p1);
Phase p2 = new Phase("PhaseB");
phases.add(p2);
PhaseHolder ph = new PhaseHolder(phases);
HandlerDescription hm = new HandlerDescription();
hm.setClassName("org.apache.axis2.phaserule.PhaseRuleHandler");
Handler h1 = new PhaseRuleHandler();
h1.init(hm);
((PhaseRuleHandler) h1).setName("PhaseFirstHandler");
hm.setHandler(h1);
hm.setName("H1");
PhaseRule rule = new PhaseRule();
rule.setPhaseName("PhaseA");
rule.setPhaseFirst(true);
rule.setPhaseLast(true);
hm.setRules(rule);
ph.addHandler(hm);
HandlerDescription hm1 = new HandlerDescription();
hm1.setClassName("org.apache.axis2.phaserule.PhaseRuleHandler");
Handler h2 = new PhaseRuleHandler();
((PhaseRuleHandler) h2).setName("Second Handler");
h2.init(hm1);
hm1.setHandler(h2);
hm1.setName("H2");
PhaseRule rule1 = new PhaseRule();
rule1.setPhaseName("PhaseA");
rule1.setAfter("H1");
hm1.setRules(rule1);
try {
ph.addHandler(hm1);
} catch (PhaseException e) {
// Caught expected Exception
return;
}
fail("This should fail with : can only have one handler, since there is a " +
"handler with both phaseFirst and PhaseLast true ");
}