Package org.apache.cxf.transport

Examples of org.apache.cxf.transport.Destination


     * @param messageContext the current message context
     * @return the id embedded in the current endpoint reference or null if not found
     */
    public static String getEndpointReferenceId(Map messageContext) {
        String id = null;
        Destination destination = (Destination) messageContext.get(Destination.class.getName());
        if (destination instanceof MultiplexDestination) {
            id = ((MultiplexDestination) destination).getId(messageContext);
        }
        return id;
    }
View Full Code Here


        if (null != serverRegistry) {
            List<Server> servers = serverRegistry.getServers();
            for (Server s : servers) {
                QName targetServiceQName = s.getEndpoint().getEndpointInfo().getService().getName();
                if (serviceQName.equals(targetServiceQName) && portNameMatches(s, portName)) {
                    Destination dest = s.getDestination();
                    if (dest instanceof MultiplexDestination) {
                        destination = (MultiplexDestination)dest;
                        break;
                    }
                }
View Full Code Here

        setupServiceInfo("http://yoko.apache.org/simple",
                         "/wsdl/simpleIdl.wsdl",
                         "SimpleCORBAService",
                         "SimpleCORBAPort");
       
        Destination destination = factory.getDestination(endpointInfo);
        assertNotNull(destination);
        target = destination.getAddress();
        assertNotNull(target);
    }
View Full Code Here

        ServiceInfo serviceInfo = new ServiceInfo();
        serviceInfo.setName(new QName("bla", "Service"));
        EndpointInfo ei = new EndpointInfo(serviceInfo, "");
        ei.setName(new QName("bla", "Port"));
       
        Destination d1 = transportFactory.getDestination(ei);
        URL url = new URL(d1.getAddress().getAddress().getValue());
        assertTrue("No random port has been allocated",
                   url.getPort() > 0);
       
    }
View Full Code Here

        ServiceInfo serviceInfo = new ServiceInfo();
        serviceInfo.setName(new QName("bla", "Service"));       
        EndpointInfo ei = new EndpointInfo(serviceInfo, "");
        ei.setName(new QName("bla", "Port"));
        ei.setAddress("http://foo");
        Destination d1 = transportFactory.getDestination(ei);
       
        Destination d2 = transportFactory.getDestination(ei);
       
        // Second get should not generate a new destination. It should just retrieve the existing one
        assertEquals(d1, d2);
       
        d2.shutdown();
       
        Destination d3 = transportFactory.getDestination(ei);
        // Now a new destination should have been created
        assertNotSame(d1, d3);
    }
View Full Code Here

    }

    protected Destination getDestination(EndpointInfo ei,
                                         EndpointReferenceType reference)
        throws IOException {
        Destination d = null;
        String addr = reference.getAddress().getValue();
        if (addr == null) {
            AddressType tp = ei.getExtensor(AddressType.class);
            if (tp != null) {
                addr = tp.getLocation();
            }
        }
        if (addr == null) {
            addr = NULL_ADDRESS;
        }
        d = destinations.get(addr);
        if (d == null) {
            d = createDestination(ei, reference);
            Destination tmpD = destinations.putIfAbsent(addr, d);
            if (tmpD != null) {
                d = tmpD;
            }
        }
        return d;
View Full Code Here

     * @param messageContext the current message context
     * @return the id embedded in the current endpoint reference or null if not found
     */
    public static String getEndpointReferenceId(Map<String, Object> messageContext) {
        String id = null;
        Destination destination = (Destination) messageContext.get(Destination.class.getName());
        if (destination instanceof MultiplexDestination) {
            id = ((MultiplexDestination) destination).getId(messageContext);
        }
        return id;
    }
View Full Code Here

        if (null != serverRegistry) {
            List<Server> servers = serverRegistry.getServers();
            for (Server s : servers) {
                QName targetServiceQName = s.getEndpoint().getEndpointInfo().getService().getName();
                if (serviceQName.equals(targetServiceQName) && portNameMatches(s, portName)) {
                    Destination dest = s.getDestination();
                    if (dest instanceof MultiplexDestination) {
                        destination = (MultiplexDestination)dest;
                        break;
                    }
                }
View Full Code Here

    }
   
    public static Destination createDecoupledDestination(Exchange exchange,
                                                         final EndpointReferenceType reference) {
        final EndpointInfo ei = exchange.get(Endpoint.class).getEndpointInfo();
        return new Destination() {
            public EndpointReferenceType getAddress() {
                return reference;
            }
            public Conduit getBackChannel(Message inMessage, Message partialResponse,
                                          EndpointReferenceType address) throws IOException {
View Full Code Here

        }
    }
   
    public static String getEndpointAddress(Message m) {
        String address = null;
        Destination d = m.getExchange().getDestination();
        if (d != null) {
            if (d instanceof AbstractHTTPDestination) {
                EndpointInfo ei = ((AbstractHTTPDestination)d).getEndpointInfo();
                HttpServletRequest request = (HttpServletRequest)m.get(AbstractHTTPDestination.HTTP_REQUEST);
                Object property = request != null
                    ? request.getAttribute("org.apache.cxf.transport.endpoint.address") : null;
                address = property != null ? property.toString() : ei.getAddress();
            } else {
                address = m.containsKey(Message.BASE_PATH)
                    ? (String)m.get(Message.BASE_PATH) : d.getAddress().getAddress().getValue();
            }
        } else {
            address = (String)m.get(Message.ENDPOINT_ADDRESS);
        }
        if (address.startsWith("http") && address.endsWith("//")) {
View Full Code Here

TOP

Related Classes of org.apache.cxf.transport.Destination

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.