use of javax.xml.ws.handler.Handler in project cloudstack by apache.
the class VmwareClient method pbmConnect.
private void pbmConnect(String url, String cookieValue) throws Exception {
URI uri = new URI(url);
String pbmurl = "https://" + uri.getHost() + "/pbm";
String[] tokens = cookieValue.split("=");
String extractedCookie = tokens[1];
HandlerResolver soapHandlerResolver = new HandlerResolver() {
@Override
public List<Handler> getHandlerChain(PortInfo portInfo) {
VcenterSessionHandler VcSessionHandler = new VcenterSessionHandler(extractedCookie);
List<Handler> handlerChain = new ArrayList<Handler>();
handlerChain.add((Handler) VcSessionHandler);
return handlerChain;
}
};
pbmService.setHandlerResolver(soapHandlerResolver);
pbmSvcInstRef.setType(PBM_SERVICE_INSTANCE_TYPE);
pbmSvcInstRef.setValue(PBM_SERVICE_INSTANCE_VALUE);
pbmPort = pbmService.getPbmPort();
Map<String, Object> pbmCtxt = ((BindingProvider) pbmPort).getRequestContext();
pbmCtxt.put(BindingProvider.SESSION_MAINTAIN_PROPERTY, true);
pbmCtxt.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, pbmurl);
}
use of javax.xml.ws.handler.Handler in project tomee by apache.
the class HandlerResolverImplTest method testPortMatching.
public void testPortMatching() throws Exception {
final HandlerChains handlerChains = readHandlerChains("/handlers_port.xml");
assertEquals(3, handlerChains.getHandlerChain().size());
final List<HandlerChainInfo> handlerChainInfos = ConfigurationFactory.toHandlerChainInfo(handlerChains);
final List<HandlerChainData> handlerChainDatas = WsBuilder.toHandlerChainData(handlerChainInfos, getClass().getClassLoader());
final HandlerResolverImpl resolver = new HandlerResolverImpl(handlerChainDatas, null, new InitialContext());
List<Handler> handlers = null;
handlers = resolver.getHandlerChain(new TestPortInfo(null, null, null));
assertEquals(0, handlers.size());
final QName portName1 = new QName("http://java.sun.com/xml/ns/javaee", "Bar");
handlers = resolver.getHandlerChain(new TestPortInfo(null, portName1, null));
assertEquals(1, handlers.size());
final QName portName2 = new QName("http://java.sun.com/xml/ns/javaee", "Foo");
handlers = resolver.getHandlerChain(new TestPortInfo(null, portName2, null));
assertEquals(2, handlers.size());
final QName portName3 = new QName("http://java.sun.com/xml/ns/javaee", "FooBar");
handlers = resolver.getHandlerChain(new TestPortInfo(null, portName3, null));
assertEquals(1, handlers.size());
final QName portName4 = new QName("http://java.sun.com/xml/ns/javaee", "BarFoo");
handlers = resolver.getHandlerChain(new TestPortInfo(null, portName4, null));
assertEquals(0, handlers.size());
}
use of javax.xml.ws.handler.Handler in project tomee by apache.
the class HandlerResolverImplTest method testBindingMatching.
public void testBindingMatching() throws Exception {
final HandlerChains handlerChains = readHandlerChains("/handlers_bindings.xml");
assertEquals(3, handlerChains.getHandlerChain().size());
final List<HandlerChainInfo> handlerChainInfos = ConfigurationFactory.toHandlerChainInfo(handlerChains);
final List<HandlerChainData> handlerChainDatas = WsBuilder.toHandlerChainData(handlerChainInfos, getClass().getClassLoader());
final HandlerResolverImpl resolver = new HandlerResolverImpl(handlerChainDatas, null, new InitialContext());
List<Handler> handlers = null;
handlers = resolver.getHandlerChain(new TestPortInfo(null, null, null));
assertEquals(0, handlers.size());
handlers = resolver.getHandlerChain(new TestPortInfo("##SOAP12_HTTP", null, null));
assertEquals(0, handlers.size());
handlers = resolver.getHandlerChain(new TestPortInfo("##SOAP11_HTTP", null, null));
assertEquals(2, handlers.size());
handlers = resolver.getHandlerChain(new TestPortInfo("##SOAP11_HTTP_MTOM", null, null));
assertEquals(1, handlers.size());
}
use of javax.xml.ws.handler.Handler in project tomee by apache.
the class HandlerResolverImplTest method testMixedMatching.
public void testMixedMatching() throws Exception {
final HandlerChains handlerChains = readHandlerChains("/handlers_mixed.xml");
assertEquals(3, handlerChains.getHandlerChain().size());
final List<HandlerChainInfo> handlerChainInfos = ConfigurationFactory.toHandlerChainInfo(handlerChains);
final List<HandlerChainData> handlerChainDatas = WsBuilder.toHandlerChainData(handlerChainInfos, getClass().getClassLoader());
final HandlerResolverImpl resolver = new HandlerResolverImpl(handlerChainDatas, null, new InitialContext());
List<Handler> handlers = null;
handlers = resolver.getHandlerChain(new TestPortInfo(null, null, null));
assertEquals(0, handlers.size());
final QName serviceName1 = new QName("http://java.sun.com/xml/ns/javaee", "Bar");
final QName portName1 = new QName("http://java.sun.com/xml/ns/javaee", "FooBar");
final String binding1 = "##XML_HTTP";
handlers = resolver.getHandlerChain(new TestPortInfo(binding1, portName1, serviceName1));
assertEquals(3, handlers.size());
final String binding2 = "##SOAP11_HTTP";
handlers = resolver.getHandlerChain(new TestPortInfo(binding2, portName1, serviceName1));
assertEquals(2, handlers.size());
final QName serviceName2 = new QName("http://java.sun.com/xml/ns/javaee", "Baaz");
final QName portName2 = new QName("http://java.sun.com/xml/ns/javaee", "Baaz");
handlers = resolver.getHandlerChain(new TestPortInfo(binding1, portName2, serviceName2));
assertEquals(1, handlers.size());
}
use of javax.xml.ws.handler.Handler in project tomee by apache.
the class CxfEndpoint method initHandlers.
/**
* Set appropriate handlers for the port/service/bindings.
*/
protected void initHandlers() throws Exception {
PortInfoImpl portInfo = new PortInfoImpl(implInfo.getBindingType(), serviceFactory.getEndpointName(), service.getName());
handlerResolver = new HandlerResolverImpl(port.getHandlerChains(), port.getInjections(), context);
List<Handler> chain = handlerResolver.getHandlerChain(portInfo);
getBinding().setHandlerChain(chain);
}
Aggregations