Package org.apache.camel.component.http

Examples of org.apache.camel.component.http.HttpExchange


            final Continuation continuation = ContinuationSupport.getContinuation(request, null);
            if (continuation.isNew()) {

                // Have the camel process the HTTP exchange.
                final HttpExchange exchange = new HttpExchange(consumer.getEndpoint(), request, response);
                boolean sync = consumer.getAsyncProcessor().process(exchange, new AsyncCallback() {
                    public void done(boolean sync) {
                        if (sync) {
                            return;
                        }
                        continuation.setObject(exchange);
                        continuation.resume();
                    }
                });

                if (!sync) {
                   
                    // Wait for the exchange to get processed.
                    // This might block until it completes or it might return via an exception and
                    // then this method is re-invoked once the the exchange has finished processing
                    continuation.suspend(0);
                   
                }
               
                // HC: The getBinding() is interesting because it illustrates the
                // impedance miss-match between
                // HTTP's stream oriented protocol, and Camels more message oriented
                // protocol exchanges.

                // now lets output to the response
                consumer.getBinding().writeResponse(exchange, response);
                return;
            }
           
            if (continuation.isResumed() ) {
                HttpExchange exchange = (HttpExchange)continuation.getObject();
                // now lets output to the response
                consumer.getBinding().writeResponse(exchange, response);
                return;
            }
View Full Code Here

TOP

Related Classes of org.apache.camel.component.http.HttpExchange

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.