Java Code Examples for org.apache.cxf.message.Exchange#getDestination()

The following examples show how to use org.apache.cxf.message.Exchange#getDestination() . 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: AbstractPolicyInterceptor.java    From cxf with Apache License 2.0 5 votes vote down vote up
protected void getTransportAssertions(Message message) {
    Exchange ex = message.getExchange();
    Conduit conduit = ex.getConduit(message);
    Assertor assertor = PolicyUtils.createAsserter(conduit);
    if (assertor == null) {
        Destination destination = ex.getDestination();
        assertor = PolicyUtils.createAsserter(destination);
    }
    if (null != assertor) {
        assertor.assertMessage(message);
    }
}
 
Example 2
Source File: OutgoingChainInterceptor.java    From cxf with Apache License 2.0 5 votes vote down vote up
protected static Conduit getBackChannelConduit(Message message) throws IOException {
    Conduit conduit = null;
    Exchange ex = message.getExchange();
    if (ex.getConduit(message) == null
        && ex.getDestination() != null) {
        try {
            conduit = ex.getDestination().getBackChannel(ex.getInMessage());
            ex.put(ConduitSelector.class,
                   new PreexistingConduitSelector(conduit, ex.getEndpoint()));
        } catch (IOException e) {
            throw new Fault(e);
        }
    }
    return conduit;
}
 
Example 3
Source File: NegotiationUtils.java    From steady with Apache License 2.0 4 votes vote down vote up
static void recalcEffectivePolicy(
    SoapMessage message, 
    String namespace, 
    Policy policy,
    Invoker invoker,
    boolean secConv
) {
    Exchange ex = message.getExchange();
    Bus bus = ex.getBus();
    PolicyEngine pe = bus.getExtension(PolicyEngine.class);
    if (null == pe) {
        return;
    }
    Destination destination = ex.getDestination();
    try {
        Endpoint endpoint = message.getExchange().getEndpoint();

        TokenStore store = getTokenStore(message);
        if (secConv) {
            endpoint = STSUtils.createSCEndpoint(bus, 
                                                 namespace,
                                                 endpoint.getEndpointInfo().getTransportId(),
                                                 destination.getAddress().getAddress().getValue(),
                                                 message.getVersion().getBindingId(), 
                                                 policy);
        } else {
            endpoint = STSUtils.createSTSEndpoint(bus, 
                                                  namespace,
                                                  endpoint.getEndpointInfo().getTransportId(),
                                                  destination.getAddress().getAddress().getValue(),
                                                  message.getVersion().getBindingId(), 
                                                  policy,
                                                  null);
        } 
        endpoint.getEndpointInfo().setProperty(TokenStore.class.getName(), store);
        message.getExchange().put(TokenStore.class.getName(), store);

        EndpointPolicy ep = pe.getServerEndpointPolicy(endpoint.getEndpointInfo(), destination);
        List<Interceptor<? extends Message>> interceptors = ep.getInterceptors();
        for (Interceptor<? extends Message> i : interceptors) {
            message.getInterceptorChain().add(i);
        }

        Collection<Assertion> assertions = ep.getVocabulary();
        if (null != assertions) {
            message.put(AssertionInfoMap.class, new AssertionInfoMap(assertions));
        }
        endpoint.getService().setInvoker(invoker);
        ex.put(Endpoint.class, endpoint);
        ex.put(Service.class, endpoint.getService());
        ex.put(org.apache.cxf.binding.Binding.class, endpoint.getBinding());
        ex.remove(BindingOperationInfo.class);
        message.put(MAPAggregator.ACTION_VERIFIED, Boolean.TRUE);
    } catch (Exception exc) {
        throw new Fault(exc);
    }
}
 
Example 4
Source File: NegotiationUtils.java    From steady with Apache License 2.0 4 votes vote down vote up
static void recalcEffectivePolicy(
    SoapMessage message, 
    String namespace, 
    Policy policy,
    Invoker invoker,
    boolean secConv
) {
    Exchange ex = message.getExchange();
    Bus bus = ex.getBus();
    PolicyEngine pe = bus.getExtension(PolicyEngine.class);
    if (null == pe) {
        return;
    }
    Destination destination = ex.getDestination();
    try {
        Endpoint endpoint = message.getExchange().getEndpoint();

        TokenStore store = getTokenStore(message);
        if (secConv) {
            endpoint = STSUtils.createSCEndpoint(bus, 
                                                 namespace,
                                                 endpoint.getEndpointInfo().getTransportId(),
                                                 destination.getAddress().getAddress().getValue(),
                                                 message.getVersion().getBindingId(), 
                                                 policy);
        } else {
            endpoint = STSUtils.createSTSEndpoint(bus, 
                                                  namespace,
                                                  endpoint.getEndpointInfo().getTransportId(),
                                                  destination.getAddress().getAddress().getValue(),
                                                  message.getVersion().getBindingId(), 
                                                  policy,
                                                  null);
        } 
        endpoint.getEndpointInfo().setProperty(TokenStore.class.getName(), store);
        message.getExchange().put(TokenStore.class.getName(), store);

        EndpointPolicy ep = pe.getServerEndpointPolicy(endpoint.getEndpointInfo(), destination);
        List<Interceptor<? extends Message>> interceptors = ep.getInterceptors();
        for (Interceptor<? extends Message> i : interceptors) {
            message.getInterceptorChain().add(i);
        }

        Collection<Assertion> assertions = ep.getVocabulary();
        if (null != assertions) {
            message.put(AssertionInfoMap.class, new AssertionInfoMap(assertions));
        }
        endpoint.getService().setInvoker(invoker);
        ex.put(Endpoint.class, endpoint);
        ex.put(Service.class, endpoint.getService());
        ex.put(org.apache.cxf.binding.Binding.class, endpoint.getBinding());
        ex.remove(BindingOperationInfo.class);
        message.put(MAPAggregator.ACTION_VERIFIED, Boolean.TRUE);
    } catch (Exception exc) {
        throw new Fault(exc);
    }
}
 
Example 5
Source File: NegotiationUtils.java    From steady with Apache License 2.0 4 votes vote down vote up
static void recalcEffectivePolicy(
    SoapMessage message, 
    String namespace, 
    Policy policy,
    Invoker invoker,
    boolean secConv
) {
    Exchange ex = message.getExchange();
    Bus bus = ex.getBus();
    PolicyEngine pe = bus.getExtension(PolicyEngine.class);
    if (null == pe) {
        return;
    }
    Destination destination = ex.getDestination();
    try {
        Endpoint endpoint = message.getExchange().getEndpoint();

        TokenStore store = getTokenStore(message);
        if (secConv) {
            endpoint = STSUtils.createSCEndpoint(bus, 
                                                 namespace,
                                                 endpoint.getEndpointInfo().getTransportId(),
                                                 destination.getAddress().getAddress().getValue(),
                                                 message.getVersion().getBindingId(), 
                                                 policy);
        } else {
            endpoint = STSUtils.createSTSEndpoint(bus, 
                                                  namespace,
                                                  endpoint.getEndpointInfo().getTransportId(),
                                                  destination.getAddress().getAddress().getValue(),
                                                  message.getVersion().getBindingId(), 
                                                  policy,
                                                  null);
        } 
        endpoint.getEndpointInfo().setProperty(TokenStore.class.getName(), store);
        message.getExchange().put(TokenStore.class.getName(), store);

        EndpointPolicy ep = pe.getServerEndpointPolicy(endpoint.getEndpointInfo(), destination);
        List<Interceptor<? extends Message>> interceptors = ep.getInterceptors();
        for (Interceptor<? extends Message> i : interceptors) {
            message.getInterceptorChain().add(i);
        }

        Collection<Assertion> assertions = ep.getVocabulary();
        if (null != assertions) {
            message.put(AssertionInfoMap.class, new AssertionInfoMap(assertions));
        }
        endpoint.getService().setInvoker(invoker);
        ex.put(Endpoint.class, endpoint);
        ex.put(Service.class, endpoint.getService());
        ex.put(org.apache.cxf.binding.Binding.class, endpoint.getBinding());
        ex.remove(BindingOperationInfo.class);
        message.put(MAPAggregator.ACTION_VERIFIED, Boolean.TRUE);
    } catch (Exception exc) {
        throw new Fault(exc);
    }
}
 
Example 6
Source File: NegotiationUtils.java    From steady with Apache License 2.0 4 votes vote down vote up
static void recalcEffectivePolicy(
    SoapMessage message, 
    String namespace, 
    Policy policy,
    Invoker invoker,
    boolean secConv
) {
    Exchange ex = message.getExchange();
    Bus bus = ex.getBus();
    PolicyEngine pe = bus.getExtension(PolicyEngine.class);
    if (null == pe) {
        return;
    }
    Destination destination = ex.getDestination();
    try {
        Endpoint endpoint = message.getExchange().getEndpoint();

        TokenStore store = getTokenStore(message);
        if (secConv) {
            endpoint = STSUtils.createSCEndpoint(bus, 
                                                 namespace,
                                                 endpoint.getEndpointInfo().getTransportId(),
                                                 destination.getAddress().getAddress().getValue(),
                                                 message.getVersion().getBindingId(), 
                                                 policy);
        } else {
            endpoint = STSUtils.createSTSEndpoint(bus, 
                                                  namespace,
                                                  endpoint.getEndpointInfo().getTransportId(),
                                                  destination.getAddress().getAddress().getValue(),
                                                  message.getVersion().getBindingId(), 
                                                  policy,
                                                  null);
        } 
        endpoint.getEndpointInfo().setProperty(TokenStore.class.getName(), store);
        message.getExchange().put(TokenStore.class.getName(), store);

        EndpointPolicy ep = pe.getServerEndpointPolicy(endpoint.getEndpointInfo(), destination);
        List<Interceptor<? extends Message>> interceptors = ep.getInterceptors();
        for (Interceptor<? extends Message> i : interceptors) {
            message.getInterceptorChain().add(i);
        }

        Collection<Assertion> assertions = ep.getVocabulary();
        if (null != assertions) {
            message.put(AssertionInfoMap.class, new AssertionInfoMap(assertions));
        }
        endpoint.getService().setInvoker(invoker);
        ex.put(Endpoint.class, endpoint);
        ex.put(Service.class, endpoint.getService());
        ex.put(org.apache.cxf.binding.Binding.class, endpoint.getBinding());
        ex.remove(BindingOperationInfo.class);
        message.put(MAPAggregator.ACTION_VERIFIED, Boolean.TRUE);
    } catch (Exception exc) {
        throw new Fault(exc);
    }
}
 
Example 7
Source File: NegotiationUtils.java    From cxf with Apache License 2.0 4 votes vote down vote up
static void recalcEffectivePolicy(
    SoapMessage message,
    String namespace,
    Policy policy,
    Invoker invoker,
    boolean secConv
) {
    Exchange ex = message.getExchange();
    Bus bus = ex.getBus();
    PolicyEngine pe = bus.getExtension(PolicyEngine.class);
    if (null == pe) {
        return;
    }
    Destination destination = ex.getDestination();
    try {
        Endpoint endpoint = message.getExchange().getEndpoint();

        TokenStore store = TokenStoreUtils.getTokenStore(message);
        if (secConv) {
            endpoint = STSUtils.createSCEndpoint(bus,
                                                 namespace,
                                                 endpoint.getEndpointInfo().getTransportId(),
                                                 destination.getAddress().getAddress().getValue(),
                                                 message.getVersion().getBindingId(),
                                                 policy);
        } else {
            endpoint = STSUtils.createSTSEndpoint(bus,
                                                  namespace,
                                                  endpoint.getEndpointInfo().getTransportId(),
                                                  destination.getAddress().getAddress().getValue(),
                                                  message.getVersion().getBindingId(),
                                                  policy,
                                                  null);
        }
        endpoint.getEndpointInfo().setProperty(TokenStore.class.getName(), store);
        message.getExchange().put(TokenStore.class.getName(), store);

        EndpointPolicy ep = pe.getServerEndpointPolicy(endpoint.getEndpointInfo(), destination, message);
        List<Interceptor<? extends Message>> interceptors = ep.getInterceptors(message);
        message.getInterceptorChain().add(interceptors);

        Collection<Assertion> assertions = ep.getVocabulary(message);
        if (null != assertions) {
            message.put(AssertionInfoMap.class, new AssertionInfoMap(assertions));
        }
        endpoint.getService().setInvoker(invoker);
        ex.put(Endpoint.class, endpoint);
        ex.put(Service.class, endpoint.getService());
        ex.put(org.apache.cxf.binding.Binding.class, endpoint.getBinding());
        ex.remove(BindingOperationInfo.class);
        message.put(MAPAggregator.ACTION_VERIFIED, Boolean.TRUE);
    } catch (Exception exc) {
        throw new Fault(exc);
    }
}
 
Example 8
Source File: MultipleEndpointObserver.java    From cxf with Apache License 2.0 4 votes vote down vote up
protected void setExchangeProperties(Exchange exchange, Message m) {
    exchange.put(Bus.class, bus);
    if (exchange.getDestination() == null) {
        exchange.setDestination(m.getDestination());
    }
}