Examples of DelegatingInputStream


Examples of org.apache.cxf.io.DelegatingInputStream

           
            if (!useOriginalThread && !robust) {
                //need to suck in all the data from the input stream as
                //the transport might discard any data on the stream when this
                //thread unwinds or when the empty response is sent back
                DelegatingInputStream in = message.getContent(DelegatingInputStream.class);
                if (in != null) {
                    in.cacheInput();
                }
            }
           
            if (robust) {
                // continue to invoke the chain
View Full Code Here

Examples of org.apache.cxf.io.DelegatingInputStream

        setupContinuation(inMessage,
                          req,
                          resp);
       
        final Exchange exchange = inMessage.getExchange();
        DelegatingInputStream in = new DelegatingInputStream(req.getInputStream()) {
            public void cacheInput() {
                if (!cached && (exchange.isOneWay() || isWSAddressingReplyToSpecified(exchange))) {
                    //For one-ways and WS-Addressing invocations with ReplyTo address,
                    //we need to cache the values of the HttpServletRequest
                    //so they can be queried later for things like paths and schemes
View Full Code Here

Examples of org.apache.cxf.io.DelegatingInputStream

        Message inMessage = outMessage.getExchange().getInMessage();
        if (inMessage == null) {
            return;
        }
        Object o = inMessage.get("cxf.io.cacheinput");
        DelegatingInputStream in = inMessage.getContent(DelegatingInputStream.class);
        if (MessageUtils.isTrue(o)) {
            Collection<Attachment> atts = inMessage.getAttachments();
            if (atts != null) {
                for (Attachment a : atts) {
                    if (a.getDataHandler().getDataSource() instanceof AttachmentDataSource) {
                        try {
                            ((AttachmentDataSource)a.getDataHandler().getDataSource()).cache(inMessage);
                        } catch (IOException e) {
                            throw new Fault(e);
                        }
                    }
                }
            }
            if (in != null) {
                in.cacheInput();
            }
        } else if (in != null) {
            //We don't need to cache it, but we may need to consume it in order for the client
            // to be able to receive a response. (could be blocked sending)
            //However, also don't want to consume indefinitely.   We'll limit to 16M.
View Full Code Here

Examples of org.apache.cxf.io.DelegatingInputStream

                   
                    if (retrieveAsyncPostResponseDispatch(inMessage)) {
                        //need to suck in all the data from the input stream as
                        //the transport might discard any data on the stream when this
                        //thread unwinds or when the empty response is sent back
                        DelegatingInputStream in = inMessage.get(DelegatingInputStream.class);
                        if (in != null) {
                            in.cacheInput();
                        }
                       
                        // async service invocation required *after* a response
                        // has been sent (i.e. to a oneway, or a partial response
                        // to a decoupled twoway)
View Full Code Here

Examples of org.apache.cxf.io.DelegatingInputStream

                                final ServletConfig config,
                                final ServletContext context,
                                final HttpServletRequest req,
                                final HttpServletResponse resp) throws IOException {

        DelegatingInputStream in = new DelegatingInputStream(req.getInputStream()) {
            public void cacheInput() {
                if (!cached) {
                    //we need to cache the values of the HttpServletRequest
                    //so they can be queried later for things like paths and schemes
                    //and such like that
View Full Code Here

Examples of org.apache.cxf.io.DelegatingInputStream

                        throw new Fault(e);
                    }
                }
            }
        }
        DelegatingInputStream in = inMessage.getContent(DelegatingInputStream.class);
        if (in != null) {
            in.cacheInput();
        }
    }
View Full Code Here

Examples of org.apache.cxf.io.DelegatingInputStream

                   
                    if (retrieveAsyncPostResponseDispatch(inMessage)) {
                        //need to suck in all the data from the input stream as
                        //the transport might discard any data on the stream when this
                        //thread unwinds or when the empty response is sent back
                        DelegatingInputStream in = inMessage.get(DelegatingInputStream.class);
                        if (in != null) {
                            in.cacheInput();
                        }
                       
                        // async service invocation required *after* a response
                        // has been sent (i.e. to a oneway, or a partial response
                        // to a decoupled twoway)
View Full Code Here

Examples of org.apache.cxf.io.DelegatingInputStream

                    exchange.put("org.apache.cxf.http.no_io_exceptions", true);
                    Destination destination = createDecoupledDestination(exchange, reference);
                    exchange.setDestination(destination);

                    if (ContextUtils.retrieveAsyncPostResponseDispatch(inMessage)) {
                        DelegatingInputStream in = inMessage.getContent(DelegatingInputStream.class);
                        if (in != null) {
                            in.cacheInput();
                        }
                        inMessage.getInterceptorChain().reset();
                        //cleanup pathinfo
                        if (inMessage.get(Message.PATH_INFO) != null) {
                            inMessage.remove(Message.PATH_INFO);
                        }
                        inMessage.getInterceptorChain().doIntercept(inMessage);

                    }

                    // send the partial response to requester
                    partialResponse.put("forced.faultstring",
                                        "The server sent HTTP status code :"
                                            + inMessage.getExchange().get(Message.RESPONSE_CODE));
                    partialResponse.setContent(Exception.class, exception);
                    partialResponse.put(org.apache.cxf.message.Message.PROTOCOL_HEADERS,
                                        inMessage.get(Message.PROTOCOL_HEADERS));
                    partialResponse.put(org.apache.cxf.message.Message.ENCODING,
                                        inMessage.get(Message.ENCODING));
                    partialResponse.put(ContextUtils.ACTION, inMessage.get(ContextUtils.ACTION));
                    partialResponse.put("javax.xml.ws.addressing.context.inbound",
                                        inMessage.get("javax.xml.ws.addressing.context.inbound"));
                    partialResponse.put("javax.xml.ws.addressing.context.outbound",
                                        inMessage.get("javax.xml.ws.addressing.context.outbound"));
                    exchange.setOutMessage(partialResponse);
                    PhaseInterceptorChain newChian = ((PhaseInterceptorChain)inMessage.getInterceptorChain())
                        .cloneChain();
                    partialResponse.setInterceptorChain(newChian);
                    exchange.setDestination(target);
                    exchange.setOneWay(false);
                    exchange.put(ConduitSelector.class,
                                 new PreexistingConduitSelector(backChannel, exchange.get(Endpoint.class)));
                    if (newChian != null && !newChian.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));
                        }
                    }
                    return;
                }
               
                if (backChannel != null) {
                    partialResponse.put(Message.PARTIAL_RESPONSE_MESSAGE, Boolean.TRUE);
                    partialResponse.put(Message.EMPTY_PARTIAL_RESPONSE_MESSAGE, Boolean.TRUE);
                    boolean robust =
                        MessageUtils.isTrue(inMessage.getContextualProperty(Message.ROBUST_ONEWAY));
                   
                    if (robust) {
                        BindingOperationInfo boi = exchange.get(BindingOperationInfo.class);
                        // insert the executor in the exchange to fool the OneWayProcessorInterceptor
                        exchange.put(Executor.class, getExecutor(inMessage));
                        // pause dispatch on current thread and resume...
                        inMessage.getInterceptorChain().pause();
                        inMessage.getInterceptorChain().resume();
                        MessageObserver faultObserver = inMessage.getInterceptorChain().getFaultObserver();
                        if (null != inMessage.getContent(Exception.class) && null != faultObserver) {
                            // return the fault over the response fault channel
                            inMessage.getExchange().setOneWay(false);
                            faultObserver.onMessage(inMessage);
                            return;
                        }
                        // restore the BOI for the partial response handling
                        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);
                    }
                    exchange.setOutMessage(fullResponse);
                   
                    Destination destination = createDecoupledDestination(
                        exchange,
                        reference);
                    exchange.setDestination(destination);
                        
                   
                    if (ContextUtils.retrieveAsyncPostResponseDispatch(inMessage) && !robust) {
                        //need to suck in all the data from the input stream as
                        //the transport might discard any data on the stream when this
                        //thread unwinds or when the empty response is sent back
                        DelegatingInputStream in = inMessage.getContent(DelegatingInputStream.class);
                        if (in != null) {
                            in.cacheInput();
                        }
                       
                        // async service invocation required *after* a response
                        // has been sent (i.e. to a oneway, or a partial response
                        // to a decoupled twoway)
View Full Code Here

Examples of org.apache.cxf.io.DelegatingInputStream

           
            if (Boolean.FALSE.equals(o)) {
                //need to suck in all the data from the input stream as
                //the transport might discard any data on the stream when this
                //thread unwinds or when the empty response is sent back
                DelegatingInputStream in = message.get(DelegatingInputStream.class);
                if (in != null) {
                    in.cacheInput();
                }
            }

           
            try {
View Full Code Here

Examples of org.apache.cxf.io.DelegatingInputStream

        setupContinuation(inMessage,
                          req,
                          resp);
       
        final Exchange exchange = inMessage.getExchange();
        DelegatingInputStream in = new DelegatingInputStream(req.getInputStream()) {
            public void cacheInput() {
                if (!cached && exchange.isOneWay()) {
                    //For one-ways, we need to cache the values of the HttpServletRequest
                    //so they can be queried later for things like paths and schemes
                    //and such like that.                  
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.