Search in sources :

Example 31 with DestinationFactoryManager

use of org.apache.cxf.transport.DestinationFactoryManager in project cxf by apache.

the class SpringBusFactoryTest method testKnownExtensions.

@Test
public void testKnownExtensions() throws BusException {
    Bus bus = new SpringBusFactory().createBus();
    assertNotNull(bus);
    checkBindingExtensions(bus);
    DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
    assertNotNull("No destination factory manager", dfm);
    ConduitInitiatorManager cim = bus.getExtension(ConduitInitiatorManager.class);
    assertNotNull("No conduit initiator manager", cim);
    checkTransportFactories(bus);
    checkOtherCoreExtensions(bus);
    // you should include instumentation extenstion to get the instrumentation manager
    assertNotNull("No instrumentation manager", bus.getExtension(InstrumentationManager.class));
    bus.shutdown(true);
}
Also used : Bus(org.apache.cxf.Bus) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) DestinationFactoryManager(org.apache.cxf.transport.DestinationFactoryManager) ConduitInitiatorManager(org.apache.cxf.transport.ConduitInitiatorManager) InstrumentationManager(org.apache.cxf.management.InstrumentationManager) Test(org.junit.Test)

Example 32 with DestinationFactoryManager

use of org.apache.cxf.transport.DestinationFactoryManager in project cxf by apache.

the class SpringBusFactoryTest method checkHTTPTransportFactories.

private void checkHTTPTransportFactories(Bus bus) throws BusException {
    ConduitInitiatorManager cim = bus.getExtension(ConduitInitiatorManager.class);
    assertNotNull("No conduit initiator manager", cim);
    assertNotNull("conduit initiator not available", cim.getConduitInitiator("http://schemas.xmlsoap.org/wsdl/soap/http"));
    assertNotNull("conduit initiator not available", cim.getConduitInitiator("http://schemas.xmlsoap.org/wsdl/http/"));
    assertNotNull("conduit initiator not available", cim.getConduitInitiator("http://cxf.apache.org/transports/http/configuration"));
    DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
    assertNotNull("No destination factory manager", dfm);
    assertNotNull("destination factory not available", dfm.getDestinationFactory("http://schemas.xmlsoap.org/wsdl/soap/"));
    assertNotNull("destination factory not available", dfm.getDestinationFactory("http://schemas.xmlsoap.org/wsdl/soap/http"));
    assertNotNull("destination factory not available", dfm.getDestinationFactory("http://schemas.xmlsoap.org/wsdl/http/"));
    assertNotNull("destination factory not available", dfm.getDestinationFactory("http://cxf.apache.org/transports/http/configuration"));
}
Also used : DestinationFactoryManager(org.apache.cxf.transport.DestinationFactoryManager) ConduitInitiatorManager(org.apache.cxf.transport.ConduitInitiatorManager)

Example 33 with DestinationFactoryManager

use of org.apache.cxf.transport.DestinationFactoryManager in project cxf by apache.

the class MtomServerTest method servStatic.

/**
 * Serve static file
 */
private void servStatic(final URL resource, final String add) throws Exception {
    Bus bus = getStaticBus();
    DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
    DestinationFactory df = dfm.getDestinationFactory("http://cxf.apache.org/transports/http/configuration");
    EndpointInfo ei = new EndpointInfo();
    ei.setAddress(add);
    Destination d = df.getDestination(ei, bus);
    d.setMessageObserver(new MessageObserver() {

        public void onMessage(Message message) {
            try {
                // HTTP seems to need this right now...
                ExchangeImpl ex = new ExchangeImpl();
                ex.setInMessage(message);
                Conduit backChannel = message.getDestination().getBackChannel(message);
                MessageImpl res = new MessageImpl();
                ex.setOutMessage(res);
                res.put(Message.CONTENT_TYPE, "text/xml");
                backChannel.prepare(res);
                OutputStream out = res.getContent(OutputStream.class);
                InputStream is = resource.openStream();
                IOUtils.copy(is, out, 2048);
                out.flush();
                out.close();
                is.close();
                backChannel.close(res);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
}
Also used : Bus(org.apache.cxf.Bus) DestinationFactory(org.apache.cxf.transport.DestinationFactory) Destination(org.apache.cxf.transport.Destination) MessageObserver(org.apache.cxf.transport.MessageObserver) DestinationFactoryManager(org.apache.cxf.transport.DestinationFactoryManager) Message(org.apache.cxf.message.Message) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) ByteArrayOutputStream(java.io.ByteArrayOutputStream) OutputStream(java.io.OutputStream) EndpointInfo(org.apache.cxf.service.model.EndpointInfo) Conduit(org.apache.cxf.transport.Conduit) MessageImpl(org.apache.cxf.message.MessageImpl) ExchangeImpl(org.apache.cxf.message.ExchangeImpl)

Example 34 with DestinationFactoryManager

use of org.apache.cxf.transport.DestinationFactoryManager in project cxf by apache.

the class MtomServerTest method unregisterServStatic.

private void unregisterServStatic(String add) throws Exception {
    Bus bus = getStaticBus();
    DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
    DestinationFactory df = dfm.getDestinationFactory("http://cxf.apache.org/transports/http/configuration");
    EndpointInfo ei = new EndpointInfo();
    ei.setAddress(add);
    Destination d = df.getDestination(ei, bus);
    d.setMessageObserver(null);
}
Also used : Bus(org.apache.cxf.Bus) DestinationFactory(org.apache.cxf.transport.DestinationFactory) EndpointInfo(org.apache.cxf.service.model.EndpointInfo) Destination(org.apache.cxf.transport.Destination) DestinationFactoryManager(org.apache.cxf.transport.DestinationFactoryManager)

Example 35 with DestinationFactoryManager

use of org.apache.cxf.transport.DestinationFactoryManager in project cxf by apache.

the class AbstractSimpleFrontendTest method setUp.

@Before
public void setUp() throws Exception {
    super.setUpBus();
    Bus bus = getBus();
    SoapBindingFactory bindingFactory = new SoapBindingFactory();
    bus.getExtension(BindingFactoryManager.class).registerBindingFactory("http://schemas.xmlsoap.org/wsdl/soap/", bindingFactory);
    DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
    SoapTransportFactory soapTF = new SoapTransportFactory();
    dfm.registerDestinationFactory("http://schemas.xmlsoap.org/wsdl/soap/", soapTF);
    dfm.registerDestinationFactory("http://schemas.xmlsoap.org/soap/", soapTF);
    LocalTransportFactory localTransport = new LocalTransportFactory();
    localTransport.getUriPrefixes().add("http");
    dfm.registerDestinationFactory("http://schemas.xmlsoap.org/wsdl/soap/http", localTransport);
    dfm.registerDestinationFactory("http://schemas.xmlsoap.org/soap/http", localTransport);
    ConduitInitiatorManager extension = bus.getExtension(ConduitInitiatorManager.class);
    extension.registerConduitInitiator(LocalTransportFactory.TRANSPORT_ID, localTransport);
    extension.registerConduitInitiator("http://schemas.xmlsoap.org/wsdl/soap/http", localTransport);
    extension.registerConduitInitiator("http://schemas.xmlsoap.org/soap/http", localTransport);
    extension.registerConduitInitiator("http://schemas.xmlsoap.org/wsdl/soap/", soapTF);
}
Also used : Bus(org.apache.cxf.Bus) SoapBindingFactory(org.apache.cxf.binding.soap.SoapBindingFactory) DestinationFactoryManager(org.apache.cxf.transport.DestinationFactoryManager) LocalTransportFactory(org.apache.cxf.transport.local.LocalTransportFactory) ConduitInitiatorManager(org.apache.cxf.transport.ConduitInitiatorManager) BindingFactoryManager(org.apache.cxf.binding.BindingFactoryManager) SoapTransportFactory(org.apache.cxf.binding.soap.SoapTransportFactory) Before(org.junit.Before)

Aggregations

DestinationFactoryManager (org.apache.cxf.transport.DestinationFactoryManager)40 Bus (org.apache.cxf.Bus)23 DestinationFactory (org.apache.cxf.transport.DestinationFactory)18 ConduitInitiatorManager (org.apache.cxf.transport.ConduitInitiatorManager)16 BindingFactoryManager (org.apache.cxf.binding.BindingFactoryManager)15 EndpointInfo (org.apache.cxf.service.model.EndpointInfo)13 QName (javax.xml.namespace.QName)9 ServiceInfo (org.apache.cxf.service.model.ServiceInfo)8 WSDLServiceBuilder (org.apache.cxf.wsdl11.WSDLServiceBuilder)8 Before (org.junit.Before)8 Test (org.junit.Test)8 Destination (org.apache.cxf.transport.Destination)7 BindingInfo (org.apache.cxf.service.model.BindingInfo)6 Definition (javax.wsdl.Definition)5 Service (javax.wsdl.Service)5 WSDLReader (javax.wsdl.xml.WSDLReader)5 SoapBindingInfo (org.apache.cxf.binding.soap.model.SoapBindingInfo)5 LocalTransportFactory (org.apache.cxf.transport.local.LocalTransportFactory)5 BusException (org.apache.cxf.BusException)4 ConduitInitiator (org.apache.cxf.transport.ConduitInitiator)4