Java Code Examples for org.apache.cxf.service.model.EndpointInfo#addExtensor()
The following examples show how to use
org.apache.cxf.service.model.EndpointInfo#addExtensor() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SoapTransportFactory.java From cxf with Apache License 2.0 | 6 votes |
private void createSoapExtensors(Bus bus, EndpointInfo ei, SoapBindingInfo bi, boolean isSoap12) { try { String address = ei.getAddress(); if (address == null) { address = "http://localhost:9090"; } ExtensionRegistry registry = bus.getExtension(WSDLManager.class).getExtensionRegistry(); SoapAddress soapAddress = SOAPBindingUtil.createSoapAddress(registry, isSoap12); soapAddress.setLocationURI(address); ei.addExtensor(soapAddress); } catch (WSDLException e) { e.printStackTrace(); } }
Example 2
Source File: HTTPConduitTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testAuthPolicyFromEndpointInfo() throws Exception { Bus bus = new ExtensionManagerBus(); EndpointInfo ei = new EndpointInfo(); AuthorizationPolicy ap = new AuthorizationPolicy(); ap.setPassword("password"); ap.setUserName("testUser"); ei.addExtensor(ap); ei.setAddress("http://nowhere.com/bar/foo"); HTTPConduit conduit = new URLConnectionHTTPConduit(bus, ei, null); conduit.finalizeConfig(); Message message = getNewMessage(); // Test call conduit.prepare(message); Map<String, List<String>> headers = CastUtils.cast((Map<?, ?>)message.get(Message.PROTOCOL_HEADERS)); assertNotNull("Authorization Header should exist", headers.get("Authorization")); assertEquals("Unexpected Authorization Token", DefaultBasicAuthSupplier.getBasicAuthHeader("testUser", "password"), headers.get("Authorization").get(0)); }
Example 3
Source File: JettyHTTPDestinationTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testServerPolicyInServiceModel() throws Exception { policy = new HTTPServerPolicy(); address = getEPR("bar/foo"); bus = BusFactory.getDefaultBus(true); transportFactory = new HTTPTransportFactory(); ServiceInfo serviceInfo = new ServiceInfo(); serviceInfo.setName(new QName("bla", "Service")); endpointInfo = new EndpointInfo(serviceInfo, ""); endpointInfo.setName(new QName("bla", "Port")); endpointInfo.addExtensor(policy); engine = EasyMock.createMock(JettyHTTPServerEngine.class); EasyMock.replay(); endpointInfo.setAddress(NOWHERE + "bar/foo"); JettyHTTPDestination dest = new EasyMockJettyHTTPDestination( bus, transportFactory.getRegistry(), endpointInfo, null, engine); assertEquals(policy, dest.getServer()); }
Example 4
Source File: UndertowHTTPDestinationTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testServerPolicyInServiceModel() throws Exception { policy = new HTTPServerPolicy(); address = getEPR("bar/foo"); bus = BusFactory.getDefaultBus(true); transportFactory = new HTTPTransportFactory(); ServiceInfo serviceInfo = new ServiceInfo(); serviceInfo.setName(new QName("bla", "Service")); endpointInfo = new EndpointInfo(serviceInfo, ""); endpointInfo.setName(new QName("bla", "Port")); endpointInfo.addExtensor(policy); engine = EasyMock.createMock(UndertowHTTPServerEngine.class); EasyMock.replay(); endpointInfo.setAddress(NOWHERE + "bar/foo"); UndertowHTTPDestination dest = new EasyMockUndertowHTTPDestination( bus, transportFactory.getRegistry(), endpointInfo, null, engine); assertEquals(policy, dest.getServer()); }
Example 5
Source File: NettyHttpDestinationTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testServerPolicyInServiceModel() throws Exception { policy = new HTTPServerPolicy(); address = getEPR("bar/foo"); bus = new ExtensionManagerBus(); transportFactory = new HTTPTransportFactory(); ServiceInfo serviceInfo = new ServiceInfo(); serviceInfo.setName(new QName("bla", "Service")); endpointInfo = new EndpointInfo(serviceInfo, ""); endpointInfo.setName(new QName("bla", "Port")); endpointInfo.addExtensor(policy); engine = EasyMock.createMock(NettyHttpServerEngine.class); EasyMock.replay(); endpointInfo.setAddress(NOWHERE + "bar/foo"); NettyHttpDestination dest = new EasyMockJettyHTTPDestination( bus, transportFactory.getRegistry(), endpointInfo, null, engine); assertEquals(policy, dest.getServer()); }
Example 6
Source File: RMEndpoint.java From cxf with Apache License 2.0 | 5 votes |
void createEndpoint(org.apache.cxf.transport.Destination d, ProtocolVariation protocol) { final QName bindingQName = new QName(protocol.getWSRMNamespace(), BINDING_NAME); WrappedService service = services.get(protocol); ServiceInfo si = service.getServiceInfo(); buildBindingInfo(si, protocol); EndpointInfo aei = applicationEndpoint.getEndpointInfo(); String transportId = aei.getTransportId(); EndpointInfo ei = new EndpointInfo(si, transportId); if (d != null) { ei.setProperty(MAPAggregator.DECOUPLED_DESTINATION, d); } ei.setAddress(aei.getAddress()); ei.setName(RMUtils.getConstants(protocol.getWSRMNamespace()).getPortName()); ei.setBinding(si.getBinding(bindingQName)); // if addressing was enabled on the application endpoint by means // of the UsingAddressing element extensor, use this for the // RM endpoint also Object ua = getUsingAddressing(aei); if (null != ua) { ei.addExtensor(ua); } si.addEndpoint(ei); ei.setProperty(SecurityConstants.TOKEN_STORE_CACHE_INSTANCE, tokenStore); Endpoint endpoint = new WrappedEndpoint(applicationEndpoint, ei, service); if (applicationEndpoint.getEndpointInfo() != null && applicationEndpoint.getEndpointInfo().getProperties() != null) { for (String key : applicationEndpoint.getEndpointInfo().getProperties().keySet()) { endpoint.getEndpointInfo() .setProperty(key, applicationEndpoint.getEndpointInfo().getProperty(key)); } } service.setEndpoint(endpoint); endpoints.put(protocol, endpoint); }
Example 7
Source File: SoapTransportFactory.java From cxf with Apache License 2.0 | 5 votes |
public EndpointInfo createEndpointInfo(Bus bus, ServiceInfo serviceInfo, BindingInfo b, List<?> ees) { String transportURI = "http://schemas.xmlsoap.org/wsdl/soap/"; if (b instanceof SoapBindingInfo) { SoapBindingInfo sbi = (SoapBindingInfo)b; transportURI = sbi.getTransportURI(); } EndpointInfo info = new SoapEndpointInfo(serviceInfo, transportURI); if (ees != null) { for (Iterator<?> itr = ees.iterator(); itr.hasNext();) { Object extensor = itr.next(); if (SOAPBindingUtil.isSOAPAddress(extensor)) { final SoapAddress sa = SOAPBindingUtil.getSoapAddress(extensor); info.addExtensor(sa); info.setAddress(sa.getLocationURI()); if (isJMSSpecAddress(sa.getLocationURI())) { info.setTransportId(SoapJMSConstants.SOAP_JMS_SPECIFICIATION_TRANSPORTID); } } else { info.addExtensor(extensor); } } } return info; }
Example 8
Source File: HTTPTransportFactory.java From cxf with Apache License 2.0 | 5 votes |
public EndpointInfo createEndpointInfo( ServiceInfo serviceInfo, BindingInfo b, List<?> ees ) { if (ees != null) { for (Iterator<?> itr = ees.iterator(); itr.hasNext();) { Object extensor = itr.next(); if (extensor instanceof AddressType) { final AddressType httpAdd = (AddressType)extensor; EndpointInfo info = new HttpEndpointInfo(serviceInfo, "http://schemas.xmlsoap.org/wsdl/http/"); info.setAddress(httpAdd.getLocation()); info.addExtensor(httpAdd); return info; } } } HttpEndpointInfo hei = new HttpEndpointInfo(serviceInfo, "http://schemas.xmlsoap.org/wsdl/http/"); AddressType at = new AddressType(); hei.addExtensor(at); return hei; }