Package org.apache.cxf.interceptor

Examples of org.apache.cxf.interceptor.InterceptorChain


        if (srv != null) {
            if (LOG.isLoggable(Level.FINE)) {
                LOG.fine("Operation:" + boi.getName() + " dispatched as colocated call.");
            }

            InterceptorChain outChain = message.getInterceptorChain();
            outChain.abort();
            exchange.put(Bus.class, bus);
            message.put(COLOCATED, Boolean.TRUE);
            message.put(Message.WSDL_OPERATION, boi.getName());
            message.put(Message.WSDL_INTERFACE, boi.getBinding().getInterface().getName());
            invokeColocObserver(message, srv.getEndpoint());
View Full Code Here


            ex.setInMessage(inMsg);
            PhaseManager pm = bus.getExtension(PhaseManager.class);
            SortedSet<Phase> phases = new TreeSet<Phase>(pm.getInPhases());
            ColocUtil.setPhases(phases, Phase.USER_LOGICAL, Phase.PRE_INVOKE);
           
            InterceptorChain chain = ColocUtil.getInInterceptorChain(ex, phases);       
            inMsg.setInterceptorChain(chain);       
            chain.doIntercept(inMsg);
        }
        ex.put(ClientImpl.FINISHED, Boolean.TRUE);
    }
View Full Code Here

                                                            partialResponse,
                                                            reference);

                if (backChannel != null) {
                    // set up interceptor chains and send message
                    InterceptorChain chain =
                        fullResponse != null
                        ? fullResponse.getInterceptorChain()
                        : OutgoingChainInterceptor.getOutInterceptorChain(exchange);
                    partialResponse.setInterceptorChain(chain);
                    exchange.put(ConduitSelector.class,
                                 new PreexistingConduitSelector(backChannel,
                                                                exchange.get(Endpoint.class)));

                    if (chain != null && !chain.doIntercept(partialResponse)
                        && partialResponse.getContent(Exception.class) != null) {
                        if (partialResponse.getContent(Exception.class) instanceof Fault) {
                            throw (Fault)partialResponse.getContent(Exception.class);
                        } else {
                            throw new Fault(partialResponse.getContent(Exception.class));
                        }
                    }
                    if (chain != null) {
                        chain.reset();                       
                    }
                    exchange.put(ConduitSelector.class, new NullConduitSelector());
                   
                    if (fullResponse == null) {
                        fullResponse = createMessage(exchange);
View Full Code Here

        exchange.setProperty(CxfConstants.CXF_EXCHANGE, cxfExchange);
        org.apache.cxf.message.Message outMessage = CxfSoapBinding.getCxfOutMessage(
                endpoint.getHeaderFilterStrategy(), exchange, true);
        outMessage.put(Message.REQUESTOR_ROLE, Boolean.TRUE);
        outMessage.put(Message.INBOUND_MESSAGE, Boolean.FALSE);
        InterceptorChain chain = OutgoingChainInterceptor.getOutInterceptorChain(cxfExchange);
        outMessage.setInterceptorChain(chain);

        chain.doIntercept(outMessage);
        CachedOutputStream outputStream = (CachedOutputStream)outMessage.getContent(OutputStream.class);
        exchange.getOut().setBody(outputStream.getInputStream());
        exchange.getIn().setBody(outputStream.getInputStream());
    }
View Full Code Here

        if (0 != (appMessageCount % 2)) {
            return;
        }
       
        // discard even-numbered message
        InterceptorChain chain = message.getInterceptorChain();
        ListIterator it = chain.getIterator();
        while (it.hasNext()) {
            PhaseInterceptor pi = (PhaseInterceptor)it.next();
            if (MessageSenderInterceptor.class.getName().equals(pi.getId())) {
                chain.remove(pi);
                LOG.fine("Removed MessageSenderInterceptor from interceptor chain.");
                break;
            }
        }
       
View Full Code Here

        appMessageCount++;
        if (0 != (appMessageCount % 2)) {
            return;
        }
       
        InterceptorChain chain = message.getInterceptorChain();
        ListIterator it = chain.getIterator();
        while (it.hasNext()) {
            PhaseInterceptor pi = (PhaseInterceptor)it.next();
            if (MessageSenderInterceptor.class.getName().equals(pi.getId())) {
                chain.remove(pi);
                LOG.fine("Removed MessageSenderInterceptor from interceptor chain.");
                break;
            }
        }
       
View Full Code Here

        Exchange ex = control.createMock(Exchange.class);
        message.getExchange();
        EasyMock.expectLastCall().andReturn(ex).anyTimes();
        ex.get("deferred.uncorrelated.message.abort");
        EasyMock.expectLastCall().andReturn(Boolean.TRUE);
        InterceptorChain chain = control.createMock(InterceptorChain.class);
        message.getInterceptorChain();
        EasyMock.expectLastCall().andReturn(chain);
        chain.abort();
        EasyMock.expectLastCall();

        control.replay();
        interceptor.handle(message);
   
View Full Code Here

                        exchange.put(BindingOperationInfo.class, boi);
                    }
                   
                   
                    // set up interceptor chains and send message
                    InterceptorChain chain =
                        fullResponse != null
                        ? fullResponse.getInterceptorChain()
                        : OutgoingChainInterceptor.getOutInterceptorChain(exchange);
                    exchange.setOutMessage(partialResponse);
                    partialResponse.setInterceptorChain(chain);
                    exchange.put(ConduitSelector.class,
                                 new PreexistingConduitSelector(backChannel,
                                                                exchange.get(Endpoint.class)));

                    if (chain != null && !chain.doIntercept(partialResponse)
                        && partialResponse.getContent(Exception.class) != null) {
                        if (partialResponse.getContent(Exception.class) instanceof Fault) {
                            throw (Fault)partialResponse.getContent(Exception.class);
                        } else {
                            throw new Fault(partialResponse.getContent(Exception.class));
                        }
                    }
                    if (chain != null) {
                        chain.reset();                       
                    }
                    exchange.put(ConduitSelector.class, new NullConduitSelector());
                   
                    if (fullResponse == null) {
                        fullResponse = ContextUtils.createMessage(exchange);
View Full Code Here

        EasyMock.expect(message.get(JAXWSAConstants.ADDRESSING_PROPERTIES_OUTBOUND))
            .andReturn(maps).anyTimes();
        RMProperties rmpsOut = new RMProperties();
        EasyMock.expect(message.get(RMMessageConstants.RM_PROPERTIES_OUTBOUND)).
            andReturn(rmpsOut).anyTimes();
        InterceptorChain chain = control.createMock(InterceptorChain.class);
        EasyMock.expect(message.getInterceptorChain()).andReturn(chain).anyTimes();
        EasyMock.expect(manager.getRMNamespace(EasyMock.same(message)))
            .andReturn(RM10Constants.NAMESPACE_URI);
        EasyMock.expect(manager.getAddressingNamespace(EasyMock.same(message)))
            .andReturn(Names200408.WSA_NAMESPACE_NAME);
        chain.add(EasyMock.isA(RetransmissionInterceptor.class));
        EasyMock.expectLastCall();
        RetransmissionQueue queue = control.createMock(RetransmissionQueue.class);
        EasyMock.expect(manager.getRetransmissionQueue()).andReturn(queue).anyTimes();
        queue.start();
        EasyMock.expectLastCall();
View Full Code Here

        }      
       
        // replace WrappedInInterceptor with BareInInterceptor if necessary
        // as RM protocol messages use paremeter style BARE

        InterceptorChain chain = message.getInterceptorChain();
        ListIterator it = chain.getIterator();           
        boolean bareIn = false;
        boolean wrappedIn = false;
        while (it.hasNext() && !wrappedIn && !bareIn) {
            PhaseInterceptor pi = (PhaseInterceptor)it.next();
            if (WrappedInInterceptor.class.getName().equals(pi.getId())) {
                wrappedIn = true;
                it.remove();
                LOG.fine("Removed WrappedInInterceptor from chain.");
            } else if (BareInInterceptor.class.getName().equals(pi.getId())) {
                bareIn = true;
            }
     
        }
        if (!bareIn) {
            chain.add(new BareInInterceptor());
            LOG.fine("Added BareInInterceptor to chain.");
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.cxf.interceptor.InterceptorChain

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.