camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r834834 - in /camel/trunk: camel-core/src/main/java/org/apache/camel/ camel-core/src/main/java/org/apache/camel/converter/ camel-core/src/main/java/org/apache/camel/processor/ components/camel-http/src/main/java/org/apache/camel/component/h...
Date Wed, 11 Nov 2009 10:29:09 GMT
Author: davsclaus
Date: Wed Nov 11 10:29:06 2009
New Revision: 834834

URL: http://svn.apache.org/viewvc?rev=834834&view=rev
Log:
CAMEL-2135: JettyHttpProducer now implemented async non blocking response parser shared with
synced mode. Removed classes and Future not needed.

Added:
    camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/DefaultJettyHttpBinding.java
  (with props)
    camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpBinding.java
  (with props)
Removed:
    camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyConverter.java
    camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyFutureGetBody.java
    camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpMessage.java
    camel/trunk/components/camel-jetty/src/main/resources/META-INF/services/org/apache/camel/TypeConverter
Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/AsyncCallback.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/converter/AsyncProcessorConverter.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/SendAsyncProcessor.java
    camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpBinding.java
    camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyContentExchange.java
    camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpEndpoint.java
    camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpProducer.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpPollingConsumerTest.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/AsyncCallback.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/AsyncCallback.java?rev=834834&r1=834833&r2=834834&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/AsyncCallback.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/AsyncCallback.java Wed Nov 11 10:29:06
2009
@@ -25,9 +25,10 @@
 public interface AsyncCallback {
 
     /**
-     * Callback when the {@link Exchange} is ready to be routed as data has been received.
+     * Callback when the async task is completed and the provided {@link Exchange}
+     * is ready to be routed.
      *
      * @param exchange the exchange
      */
-    void onDataReceived(Exchange exchange);
+    void onTaskCompleted(Exchange exchange);
 }

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/converter/AsyncProcessorConverter.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/converter/AsyncProcessorConverter.java?rev=834834&r1=834833&r2=834834&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/converter/AsyncProcessorConverter.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/converter/AsyncProcessorConverter.java
Wed Nov 11 10:29:06 2009
@@ -45,7 +45,7 @@
             } catch (Exception e) {
                 exchange.setException(e);
             }
-            callback.onDataReceived(exchange);
+            callback.onTaskCompleted(exchange);
         }
     }
 

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/SendAsyncProcessor.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/SendAsyncProcessor.java?rev=834834&r1=834833&r2=834834&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/SendAsyncProcessor.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/SendAsyncProcessor.java
Wed Nov 11 10:29:06 2009
@@ -88,7 +88,7 @@
 
                 // pass in the callback that adds the exchange to the completed list of tasks
                 final AsyncCallback callback = new AsyncCallback() {
-                    public void onDataReceived(Exchange exchange) {
+                    public void onTaskCompleted(Exchange exchange) {
                         completedTasks.add(exchange);
                     }
                 };

Modified: camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpBinding.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpBinding.java?rev=834834&r1=834833&r2=834834&view=diff
==============================================================================
--- camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpBinding.java
(original)
+++ camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpBinding.java
Wed Nov 11 10:29:06 2009
@@ -69,9 +69,9 @@
     void writeResponse(Exchange exchange, HttpServletResponse response) throws IOException;
 
     /**
-     * Strategy method that writes the response to the http response stream when an exception
occuerd
+     * Strategy method that writes the response to the http response stream when an exception
occurred
      *
-     * @param exception  the exception occured
+     * @param exception  the exception occurred
      * @param response   the http response
      * @throws java.io.IOException can be thrown from http response
      */

Added: camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/DefaultJettyHttpBinding.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/DefaultJettyHttpBinding.java?rev=834834&view=auto
==============================================================================
--- camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/DefaultJettyHttpBinding.java
(added)
+++ camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/DefaultJettyHttpBinding.java
Wed Nov 11 10:29:06 2009
@@ -0,0 +1,121 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty;
+
+import java.io.IOException;
+import java.util.Map;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.component.http.HttpHeaderFilterStrategy;
+import org.apache.camel.spi.HeaderFilterStrategy;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * @version $Revision$
+ */
+public class DefaultJettyHttpBinding implements JettyHttpBinding {
+
+    private static final transient Log LOG = LogFactory.getLog(DefaultJettyHttpBinding.class);
+    private HeaderFilterStrategy headerFilterStrategy = new HttpHeaderFilterStrategy();
+    private boolean throwExceptionOnFailure;
+
+    public void populateResponse(Exchange exchange, JettyContentExchange httpExchange) throws
Exception {
+        int responseCode = httpExchange.getResponseStatus();
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("HTTP responseCode: " + responseCode);
+        }
+
+        Message in = exchange.getIn();
+        if (!isThrowExceptionOnFailure()) {
+            // if we do not use failed exception then populate response for all response
codes
+            populateResponse(exchange, httpExchange, exchange.getIn(), getHeaderFilterStrategy(),
responseCode);
+        } else {
+            if (responseCode >= 100 && responseCode < 300) {
+                // only populate response for OK response
+                populateResponse(exchange, httpExchange, in, getHeaderFilterStrategy(), responseCode);
+            } else {
+                // operation failed so populate exception to throw
+                throw populateHttpOperationFailedException(exchange, httpExchange, responseCode);
+            }
+        }
+    }
+
+    public HeaderFilterStrategy getHeaderFilterStrategy() {
+        return headerFilterStrategy;
+    }
+
+    public void setHeaderFilterStrategy(HeaderFilterStrategy headerFilterStrategy) {
+        this.headerFilterStrategy = headerFilterStrategy;
+    }
+
+    public boolean isThrowExceptionOnFailure() {
+        return throwExceptionOnFailure;
+    }
+
+    public void setThrowExceptionOnFailure(boolean throwExceptionOnFailure) {
+        this.throwExceptionOnFailure = throwExceptionOnFailure;
+    }
+
+    protected void populateResponse(Exchange exchange, JettyContentExchange httpExchange,
+                                    Message in, HeaderFilterStrategy strategy, int responseCode)
throws IOException {
+        Message answer = exchange.getOut();
+
+        answer.setHeaders(in.getHeaders());
+        answer.setHeader(Exchange.HTTP_RESPONSE_CODE, responseCode);
+        answer.setBody(httpExchange.getBody());
+
+        // propagate HTTP response headers
+        for (Map.Entry<String, Object> entry : httpExchange.getHeaders().entrySet())
{
+            String name = entry.getKey();
+            Object value = entry.getValue();
+            if (name.toLowerCase().equals("content-type")) {
+                name = Exchange.CONTENT_TYPE;
+            }
+            if (strategy != null && !strategy.applyFilterToExternalHeaders(name,
value, exchange)) {
+                answer.setHeader(name, value);
+            }
+        }
+    }
+
+    protected JettyHttpOperationFailedException populateHttpOperationFailedException(Exchange
exchange, JettyContentExchange httpExchange,
+                                                                                     int
responseCode) throws IOException {
+        JettyHttpOperationFailedException exception;
+        String uri = httpExchange.getUrl();
+        Map<String, Object> headers = httpExchange.getHeaders();
+        String body = httpExchange.getBody();
+
+        if (responseCode >= 300 && responseCode < 400) {
+            String locationHeader = httpExchange.getResponseFields().getStringField("location");
+            if (locationHeader != null) {
+                exception = new JettyHttpOperationFailedException(uri, responseCode, locationHeader,
headers, body);
+            } else {
+                // no redirect location
+                exception = new JettyHttpOperationFailedException(uri, responseCode, headers,
body);
+            }
+        } else {
+            // internal server error (error code 500)
+            exception = new JettyHttpOperationFailedException(uri, responseCode, headers,
body);
+        }
+
+        return exception;
+    }
+
+
+}

Propchange: camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/DefaultJettyHttpBinding.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/DefaultJettyHttpBinding.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyContentExchange.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyContentExchange.java?rev=834834&r1=834833&r2=834834&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyContentExchange.java
(original)
+++ camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyContentExchange.java
Wed Nov 11 10:29:06 2009
@@ -77,14 +77,13 @@
     @Override
     protected void onResponseComplete() throws IOException {
         bodyComplete.countDown();
-
         if (LOG.isDebugEnabled()) {
             LOG.debug("onResponseComplete for " + getUrl());
         }
 
         if (callback != null && exchange != null) {
             // signal we are complete
-            callback.onDataReceived(exchange);
+            callback.onTaskCompleted(exchange);
         }
     }
 

Added: camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpBinding.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpBinding.java?rev=834834&view=auto
==============================================================================
--- camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpBinding.java
(added)
+++ camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpBinding.java
Wed Nov 11 10:29:06 2009
@@ -0,0 +1,70 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.spi.HeaderFilterStrategy;
+
+/**
+ * Jetty specific binding to parse the response when using {@link org.apache.camel.component.jetty.JettyHttpProducer}
+ *
+ * @version $Revision$
+ */
+public interface JettyHttpBinding {
+
+    /**
+     * Parses the response from the Jetty client.
+     *
+     * @param exchange  the Exchange which to populate with the response
+     * @param httpExchange  the response from the Jetty client
+     * @throws Exception is thrown if error parsing response
+     */
+    void populateResponse(Exchange exchange, JettyContentExchange httpExchange) throws Exception;
+
+    /**
+     * Gets the header filter strategy
+     *
+     * @return the strategy
+     */
+    HeaderFilterStrategy getHeaderFilterStrategy();
+
+    /**
+     * Sets the header filter strategy to use.
+     * <p/>
+     * Will default use {@link org.apache.camel.component.http.HttpHeaderFilterStrategy}
+     *
+     * @param headerFilterStrategy the custom strategy
+     */
+    void setHeaderFilterStrategy(HeaderFilterStrategy headerFilterStrategy);
+
+    /**
+     * Whether to throw {@link org.apache.camel.component.jetty.JettyHttpOperationFailedException}
+     * in case of response code != 200.
+     *
+     * @param throwExceptionOnFailure <tt>true</tt> to throw exception
+     */
+    void setThrowExceptionOnFailure(boolean throwExceptionOnFailure);
+
+    /**
+     * Whether to throw {@link org.apache.camel.component.jetty.JettyHttpOperationFailedException}
+     * in case of response code != 200.
+     *
+     * @return <tt>true</tt> to throw exception
+     */
+    boolean isThrowExceptionOnFailure();
+
+}

Propchange: camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpBinding.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpBinding.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpEndpoint.java?rev=834834&r1=834833&r2=834834&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpEndpoint.java
(original)
+++ camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpEndpoint.java
Wed Nov 11 10:29:06 2009
@@ -36,6 +36,7 @@
     private boolean sessionSupport;
     private List<Handler> handlers;
     private HttpClient client;
+    private JettyHttpBinding jettyBinding;
 
     public JettyHttpEndpoint(JettyHttpComponent component, String uri, URI httpURL) throws
URISyntaxException {
         super(uri, component, httpURL);
@@ -48,7 +49,9 @@
 
     @Override
     public Producer createProducer() throws Exception {
-        return new JettyHttpProducer(this, getClient());
+        JettyHttpProducer answer = new JettyHttpProducer(this, getClient());
+        answer.setBinding(getJettyBinding());
+        return answer;
     }
 
     @Override
@@ -83,4 +86,16 @@
         this.client = client;
     }
 
+    public synchronized JettyHttpBinding getJettyBinding() {
+        if (jettyBinding == null) {
+            jettyBinding = new DefaultJettyHttpBinding();
+            jettyBinding.setHeaderFilterStrategy(getHeaderFilterStrategy());
+            jettyBinding.setThrowExceptionOnFailure(isThrowExceptionOnFailure());
+        }
+        return jettyBinding;
+    }
+
+    public void setJettyBinding(JettyHttpBinding jettyBinding) {
+        this.jettyBinding = jettyBinding;
+    }
 }

Modified: camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpProducer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpProducer.java?rev=834834&r1=834833&r2=834834&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpProducer.java
(original)
+++ camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpProducer.java
Wed Nov 11 10:29:06 2009
@@ -41,9 +41,7 @@
 public class JettyHttpProducer extends DefaultProducer implements AsyncProcessor {
     private static final transient Log LOG = LogFactory.getLog(JettyHttpProducer.class);
     private final HttpClient client;
-
-    // TODO: support that bridge option
-    // TODO: more unit tests
+    private JettyHttpBinding binding;
 
     public JettyHttpProducer(Endpoint endpoint, HttpClient client) {
         super(endpoint);
@@ -62,11 +60,32 @@
         sendSynchronous(exchange, client, httpExchange);
     }
 
-    public void process(Exchange exchange, AsyncCallback callback) throws Exception {
+    public void process(Exchange exchange, final AsyncCallback callback) throws Exception
{
         HttpClient client = getEndpoint().getClient();
 
-        JettyContentExchange httpExchange = createHttpExchange(exchange);
-        sendAsynchronous(exchange, client, httpExchange, callback);
+        final JettyContentExchange httpExchange = createHttpExchange(exchange);
+
+        // wrap the original callback into another so we can populate the response
+        // before we signal completion to the original callback which then will start routing
the exchange
+        AsyncCallback wrapped = new AsyncCallback() {
+            public void onTaskCompleted(Exchange exchange) {
+                // at first we must populate the response
+                try {
+                    getBinding().populateResponse(exchange, httpExchange);
+                } catch (JettyHttpOperationFailedException e) {
+                    // can be expected
+                    exchange.setException(e);
+                } catch (Exception e) {
+                    LOG.error("Error populating response from " + httpExchange.getUrl() +
" on Exchange " + exchange, e);
+                    exchange.setException(e);
+                } finally {
+                    // now we are ready so signal completion to the original callback
+                    callback.onTaskCompleted(exchange);
+                }
+            }
+        };
+
+        sendAsynchronous(exchange, client, httpExchange, wrapped);
     }
 
     protected void sendAsynchronous(final Exchange exchange, final HttpClient client, final
JettyContentExchange httpExchange,
@@ -75,9 +94,6 @@
         httpExchange.setCallback(callback);
         httpExchange.setExchange(exchange);
 
-        // set the body with the message holder
-        exchange.setOut(new JettyHttpMessage(exchange, httpExchange, getEndpoint().isThrowExceptionOnFailure()));
-
         doSendExchange(client, httpExchange);
     }
 
@@ -87,74 +103,7 @@
         // we send synchronous so wait for it to be done
         httpExchange.waitForDone();
         // and then process the response
-        processResponse(exchange, httpExchange);
-    }
-
-    protected void processResponse(Exchange exchange, JettyContentExchange httpExchange)
throws IOException, JettyHttpOperationFailedException {
-        int responseCode = httpExchange.getResponseStatus();
-
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("HTTP responseCode: " + responseCode);
-        }
-
-        Message in = exchange.getIn();
-        HeaderFilterStrategy strategy = getEndpoint().getHeaderFilterStrategy();
-        if (!getEndpoint().isThrowExceptionOnFailure()) {
-            // if we do not use failed exception then populate response for all response
codes
-            populateResponse(exchange, httpExchange, exchange.getIn(), strategy, responseCode);
-        } else {
-            if (responseCode >= 100 && responseCode < 300) {
-                // only populate response for OK response
-                populateResponse(exchange, httpExchange, in, strategy, responseCode);
-            } else {
-                // operation failed so populate exception to throw
-                throw populateHttpOperationFailedException(exchange, httpExchange, responseCode);
-            }
-        }
-    }
-
-    protected void populateResponse(Exchange exchange, JettyContentExchange httpExchange,
-                                    Message in, HeaderFilterStrategy strategy, int responseCode)
throws IOException {
-        Message answer = exchange.getOut();
-
-        answer.setHeaders(in.getHeaders());
-        answer.setHeader(Exchange.HTTP_RESPONSE_CODE, responseCode);
-        answer.setBody(httpExchange.getBody());
-
-        // propagate HTTP response headers
-        for (Map.Entry<String, Object> entry : httpExchange.getHeaders().entrySet())
{
-            String name = entry.getKey();
-            Object value = entry.getValue();
-            if (name.toLowerCase().equals("content-type")) {
-                name = Exchange.CONTENT_TYPE;
-            }
-            if (strategy != null && !strategy.applyFilterToExternalHeaders(name,
value, exchange)) {
-                answer.setHeader(name, value);
-            }
-        }
-    }
-
-    protected JettyHttpOperationFailedException populateHttpOperationFailedException(Exchange
exchange, JettyContentExchange httpExchange,
-                                                                                     int
responseCode) throws IOException {
-        JettyHttpOperationFailedException exception;
-        String uri = httpExchange.getUrl();
-        Map<String, Object> headers = httpExchange.getHeaders();
-        String body = httpExchange.getBody();
-
-        if (responseCode >= 300 && responseCode < 400) {
-            String locationHeader = httpExchange.getResponseFields().getStringField("location");
-            if (locationHeader != null) {
-                exception = new JettyHttpOperationFailedException(uri, responseCode, locationHeader,
headers, body);
-            } else {
-                // no redirect location
-                exception = new JettyHttpOperationFailedException(uri, responseCode, headers,
body);
-            }
-        } else {
-            // internal server error (error code 500)
-            exception = new JettyHttpOperationFailedException(uri, responseCode, headers,
body);
-        }
-
-        return exception;
+        getBinding().populateResponse(exchange, httpExchange);
     }
 
     protected JettyContentExchange createHttpExchange(Exchange exchange) throws Exception
{
@@ -209,6 +158,14 @@
         client.send(httpExchange);
     }
 
+    public JettyHttpBinding getBinding() {
+        return binding;
+    }
+
+    public void setBinding(JettyHttpBinding binding) {
+        this.binding = binding;
+    }
+
     @Override
     protected void doStart() throws Exception {
         super.doStart();

Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpPollingConsumerTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpPollingConsumerTest.java?rev=834834&r1=834833&r2=834834&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpPollingConsumerTest.java
(original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpPollingConsumerTest.java
Wed Nov 11 10:29:06 2009
@@ -30,20 +30,20 @@
 
     @Test
     public void testReceive() throws Exception {
-        String body = consumer.receiveBody("http://localhost:9080/test", String.class);
+        String body = consumer.receiveBody("http://localhost:9444/test", String.class);
         assertEquals("Bye World", body);
     }
 
     @Test
     public void testReceiveTimeout() throws Exception {
-        String body = consumer.receiveBody("http://localhost:9080/test", 5000, String.class);
+        String body = consumer.receiveBody("http://localhost:9444/test", 5000, String.class);
         assertEquals("Bye World", body);
     }
 
     @Test
     public void testReceiveTimeoutTriggered() throws Exception {
         try {
-            consumer.receiveBody("http://localhost:9080/test", 250, String.class);
+            consumer.receiveBody("http://localhost:9444/test", 250, String.class);
             fail("Should have thrown an exception");
         } catch (RuntimeCamelException e) {
             assertIsInstanceOf(SocketTimeoutException.class, e.getCause());
@@ -55,7 +55,7 @@
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                from("jetty://http://localhost:9080/test")
+                from("jetty://http://localhost:9444/test")
                     .delay(2000).transform(constant("Bye World"));
             }
         };



Mime
View raw message