Search in sources :

Example 1 with RawMessageContentRedirectInterceptor

use of org.apache.camel.component.cxf.interceptors.RawMessageContentRedirectInterceptor in project camel by apache.

the class RAWDataFormatFeature method initialize.

@Override
public void initialize(Server server, Bus bus) {
    // currently we do not filter the bus
    // remove the interceptors
    removeInterceptorWhichIsOutThePhases(server.getEndpoint().getService().getInInterceptors(), REMAINING_IN_PHASES, getInInterceptorNames());
    removeInterceptorWhichIsOutThePhases(server.getEndpoint().getInInterceptors(), REMAINING_IN_PHASES, getInInterceptorNames());
    //we need to keep the LoggingOutputInterceptor
    getOutInterceptorNames().add(LoggingOutInterceptor.class.getName());
    // Do not using the binding interceptor any more
    server.getEndpoint().getBinding().getInInterceptors().clear();
    removeInterceptorWhichIsOutThePhases(server.getEndpoint().getService().getOutInterceptors(), REMAINING_OUT_PHASES, getOutInterceptorNames());
    removeInterceptorWhichIsOutThePhases(server.getEndpoint().getOutInterceptors(), REMAINING_OUT_PHASES, getOutInterceptorNames());
    // Do not use the binding interceptor any more
    server.getEndpoint().getBinding().getOutInterceptors().clear();
    server.getEndpoint().getOutInterceptors().add(new RawMessageContentRedirectInterceptor());
    // setup the RawMessageWSDLGetInterceptor
    server.getEndpoint().getInInterceptors().add(RawMessageWSDLGetInterceptor.INSTANCE);
    // Oneway with RAW message
    if (isOneway()) {
        Interceptor<? extends Message> toRemove = null;
        for (Interceptor<? extends Message> i : server.getEndpoint().getService().getInInterceptors()) {
            if (i.getClass().getName().equals("org.apache.cxf.interceptor.OutgoingChainInterceptor")) {
                toRemove = i;
            }
        }
        server.getEndpoint().getService().getInInterceptors().remove(toRemove);
        server.getEndpoint().getInInterceptors().add(new OneWayOutgoingChainInterceptor());
        server.getEndpoint().getInInterceptors().add(new OneWayProcessorInterceptor());
    }
}
Also used : OneWayProcessorInterceptor(org.apache.cxf.interceptor.OneWayProcessorInterceptor) LoggingOutInterceptor(org.apache.cxf.interceptor.LoggingOutInterceptor) OneWayOutgoingChainInterceptor(org.apache.camel.component.cxf.interceptors.OneWayOutgoingChainInterceptor) RawMessageContentRedirectInterceptor(org.apache.camel.component.cxf.interceptors.RawMessageContentRedirectInterceptor)

Example 2 with RawMessageContentRedirectInterceptor

use of org.apache.camel.component.cxf.interceptors.RawMessageContentRedirectInterceptor in project camel by apache.

the class RAWDataFormatFeature method initialize.

@Override
public void initialize(Client client, Bus bus) {
    //check if there is logging interceptor
    removeInterceptorWhichIsOutThePhases(client.getInInterceptors(), REMAINING_IN_PHASES, getInInterceptorNames());
    removeInterceptorWhichIsOutThePhases(client.getEndpoint().getInInterceptors(), REMAINING_IN_PHASES, getInInterceptorNames());
    client.getEndpoint().getBinding().getInInterceptors().clear();
    //we need to keep the LoggingOutputInterceptor
    getOutInterceptorNames().add(LoggingOutInterceptor.class.getName());
    removeInterceptorWhichIsOutThePhases(client.getOutInterceptors(), REMAINING_OUT_PHASES, getOutInterceptorNames());
    removeInterceptorWhichIsOutThePhases(client.getEndpoint().getOutInterceptors(), REMAINING_OUT_PHASES, getOutInterceptorNames());
    client.getEndpoint().getBinding().getOutInterceptors().clear();
    client.getEndpoint().getOutInterceptors().add(new RawMessageContentRedirectInterceptor());
}
Also used : LoggingOutInterceptor(org.apache.cxf.interceptor.LoggingOutInterceptor) RawMessageContentRedirectInterceptor(org.apache.camel.component.cxf.interceptors.RawMessageContentRedirectInterceptor)

Aggregations

RawMessageContentRedirectInterceptor (org.apache.camel.component.cxf.interceptors.RawMessageContentRedirectInterceptor)2 LoggingOutInterceptor (org.apache.cxf.interceptor.LoggingOutInterceptor)2 OneWayOutgoingChainInterceptor (org.apache.camel.component.cxf.interceptors.OneWayOutgoingChainInterceptor)1 OneWayProcessorInterceptor (org.apache.cxf.interceptor.OneWayProcessorInterceptor)1