Package org.apache.cxf.endpoint

Examples of org.apache.cxf.endpoint.ServerImpl


    }
   
    protected void doPublish(String addr) {
        checkPublishPermission();
       
        ServerImpl serv = getServer(addr);
        if (addr != null) {           
            EndpointInfo endpointInfo = serv.getEndpoint().getEndpointInfo();
            endpointInfo.setAddress(addr);
            if (publishedEndpointUrl != null) {
                // TODO is there a good place to put this key-string as a constant?
                endpointInfo.setProperty("publishedEndpointUrl", publishedEndpointUrl);
            }
        }
        serv.start();
    }
View Full Code Here


       
        SoapBindingConfiguration config = new SoapBindingConfiguration();
        config.setVersion(Soap12.getInstance());
        svrBean2.setBindingConfig(config);
       
        ServerImpl server2 = (ServerImpl)svrBean2.create();
       
        Destination d = server2.getDestination();
        MessageObserver mo = d.getMessageObserver();
        assertTrue(mo instanceof MultipleEndpointObserver);
       
        MultipleEndpointObserver meo = (MultipleEndpointObserver) mo;
        assertEquals(2, meo.getEndpoints().size());
View Full Code Here

            if (serviceBean != null && getServiceClass() == null) {
                setServiceClass(serviceBean.getClass());
            }
           
            Endpoint ep = createEndpoint();
            server = new ServerImpl(getBus(),
                                    ep,
                                    getDestinationFactory(),
                                    getBindingFactory());
           
            if (serviceBean != null) {
View Full Code Here

     */
    protected void doPublish(String addr) {
        checkPublishPermission();
        checkPublishable();
       
        ServerImpl serv = null;
       
        ClassLoaderHolder loader = null;
        try {
            if (bus != null) {
                ClassLoader newLoader = bus.getExtension(ClassLoader.class);
                if (newLoader != null) {
                    loader = ClassLoaderUtils.setThreadContextClassloader(newLoader);
                }
            }
            serv = getServer(addr);
            if (addr != null) {           
                EndpointInfo endpointInfo = serv.getEndpoint().getEndpointInfo();
                if (!endpointInfo.getAddress().contains(addr)) {
                    endpointInfo.setAddress(addr);
                }
                if (publishedEndpointUrl != null) {
                    endpointInfo.setProperty(WSDLGetUtils.PUBLISHED_ENDPOINT_URL, publishedEndpointUrl);
                }
                if (publishedEndpointUrl != null && wsdlLocation != null) {
                    //early update the publishedEndpointUrl so that endpoints in the same app sharing the same wsdl
                    //do not require all of them to be queried for wsdl before the wsdl is finally fully updated
                    Definition def = endpointInfo.getService()
                        .getProperty(WSDLServiceBuilder.WSDL_DEFINITION, Definition.class);
                    if (def == null) {
                        def = bus.getExtension(WSDLManager.class).getDefinition(wsdlLocation);
                    }
                    new WSDLGetUtils().updateWSDLPublishedEndpointAddress(def, endpointInfo);
                }

                if (null != properties) {
                    for (Entry<String, Object> entry : properties.entrySet()) {
                        endpointInfo.setProperty(entry.getKey(), entry.getValue());
                    }
                }

                this.address = endpointInfo.getAddress();
            }
            serv.start();
            publishable = false;
        } catch (Exception ex) {
            try {
                stop();
            } catch (Exception e) {
View Full Code Here

                    invoker = createInvoker();
                    getServiceFactory().setInvoker(invoker);
                }
   
                Endpoint ep = createEndpoint();
                server = new ServerImpl(getBus(),
                                        ep,
                                        getDestinationFactory(),
                                        getBindingFactory());
   
                if (ep.getService().getInvoker() == null) {
View Full Code Here

    }
   
    public Server create() {
        try {
            Endpoint ep = createEndpoint();
            server = new ServerImpl(getBus(),
                                    ep,
                                    getDestinationFactory(),
                                    getBindingFactory());

            if (invoker == null) {
View Full Code Here

   
    protected void doPublish(String addr) {
        checkPublishPermission();
       
        try {
            ServerImpl serv = getServer(addr);
            if (addr != null) {           
                EndpointInfo endpointInfo = serv.getEndpoint().getEndpointInfo();
                if (!endpointInfo.getAddress().contains(addr)) {
                    endpointInfo.setAddress(addr);
                }
                if (publishedEndpointUrl != null) {
                    // TODO is there a good place to put this key-string as a constant?
                    endpointInfo.setProperty("publishedEndpointUrl", publishedEndpointUrl);
                }
                this.address = endpointInfo.getAddress();
            }
            serv.start();
        } catch (WebServiceException ex) {
            throw ex;
        } catch (Exception ex) {
            throw new WebServiceException(ex);
        }
View Full Code Here

            } else if (serviceBean != null) {
                getServiceFactory().setInvoker(createInvoker());
            }

            Endpoint ep = createEndpoint();
            server = new ServerImpl(getBus(),
                                    ep,
                                    getDestinationFactory(),
                                    getBindingFactory());

            if (ep.getService().getInvoker() == null) {
View Full Code Here

     */
    protected void doPublish(String addr) {
        checkPublishPermission();
        checkPublishable();
       
        ServerImpl serv = null;
       
        ClassLoaderHolder loader = null;
        try {
            if (bus != null) {
                ClassLoader newLoader = bus.getExtension(ClassLoader.class);
                if (newLoader != null) {
                    loader = ClassLoaderUtils.setThreadContextClassloader(newLoader);
                }
            }
            serv = getServer(addr);
            if (addr != null) {           
                EndpointInfo endpointInfo = serv.getEndpoint().getEndpointInfo();
                if (!endpointInfo.getAddress().contains(addr)) {
                    endpointInfo.setAddress(addr);
                }
                if (publishedEndpointUrl != null) {
                    // TODO is there a good place to put this key-string as a constant?
                    endpointInfo.setProperty("publishedEndpointUrl", publishedEndpointUrl);
                }

                if (null != properties) {
                    for (Entry<String, Object> entry : properties.entrySet()) {
                        endpointInfo.setProperty(entry.getKey(), entry.getValue());
                    }
                }

                this.address = endpointInfo.getAddress();
            }
            serv.start();
            publishable = false;
        } catch (Exception ex) {
            try {
                stop();
            } catch (Exception e) {
View Full Code Here

       
        Map<String, Object> props = new HashMap<String, Object>();
        props.put("contextMatchStrategy", "stem");
        sf.setProperties(props);
       
        ServerImpl svr = (ServerImpl) sf.create();
               
        URIMapper mapper = (URIMapper) svr.getEndpoint().getService().get(URIMapper.class.getName());
        assertNotNull(mapper);
       
        BindingOperationInfo bop = mapper.getOperation("/customers", "GET", null);
        assertNotNull(bop);
        assertEquals("getCustomers", bop.getName().getLocalPart());
        assertTrue(bop.isUnwrappedCapable());
       
        bop = mapper.getOperation("/customers", "POST", null);
        assertNotNull(bop);
        assertEquals("addCustomer", bop.getName().getLocalPart());
       
        bop = mapper.getOperation("/customers/123", "GET", null);
        assertNotNull(bop);    
        assertEquals("getCustomer", bop.getName().getLocalPart());
       
        bop = mapper.getOperation("/customers/123", "PUT", null);
        assertNotNull(bop);
        assertEquals("updateCustomer", bop.getName().getLocalPart());
       
        // TEST POST/GETs
        Document res = get("http://localhost:9001/customers");
        assertNotNull(res);
       
        addNamespace("c", "http://cxf.apache.org/jra");
        assertValid("/c:getCustomersResponse/c:customers", res);
        assertValid("/c:getCustomersResponse/c:customers/c:customer/c:id[text()='123']", res);
        assertValid("/c:getCustomersResponse/c:customers/c:customer/c:name[text()='Dan Diephouse']", res);
       
        res = get("http://localhost:9001/customers/123");
        assertNotNull(res);

        addNamespace("c", "http://cxf.apache.org/jra");
        assertValid("/c:getCustomerResponse/c:customer", res);
        assertValid("/c:getCustomerResponse/c:customer/c:id[text()='123']", res);
        assertValid("/c:getCustomerResponse/c:customer/c:name[text()='Dan Diephouse']", res);
       
        res = put("http://localhost:9001/customers/123", "update.xml");
        assertNotNull(res);

        assertValid("/c:updateCustomerResponse", res);
       
        res = post("http://localhost:9001/customers", "add.xml");
        assertNotNull(res);

        assertValid("/c:addCustomerResponse", res);

        // Get the updated document
        res = get("http://localhost:9001/customers/123");
        assertNotNull(res);

        assertValid("/c:getCustomerResponse/c:customer", res);
        assertValid("/c:getCustomerResponse/c:customer/c:id[text()='123']", res);
        assertValid("/c:getCustomerResponse/c:customer/c:name[text()='Danno Manno']", res);

        svr.stop();
    }
View Full Code Here

TOP

Related Classes of org.apache.cxf.endpoint.ServerImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.