Search in sources :

Example 1 with OneWayProcessorInterceptor

use of org.apache.cxf.interceptor.OneWayProcessorInterceptor 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)

Aggregations

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