You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by jo...@apache.org on 2010/11/24 07:49:35 UTC

svn commit: r1038502 - in /camel/trunk/components: ./ camel-cxf/src/main/java/org/apache/camel/component/cxf/ camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/ camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/ camel-osgi/ camel-...

Author: joed
Date: Wed Nov 24 06:49:35 2010
New Revision: 1038502

URL: http://svn.apache.org/viewvc?rev=1038502&view=rev
Log:
Fixes the jaxrs endpoint not handling exceptions.
Exceptions are by default if the code returned is > 207 handled.


Added:
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfOperationException.java
    camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfOperationExceptionTest.java
Modified:
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConstants.java
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java
    camel/trunk/components/camel-osgi/pom.xml
    camel/trunk/components/camel-spring/pom.xml
    camel/trunk/components/pom.xml

Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConstants.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConstants.java?rev=1038502&r1=1038501&r2=1038502&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConstants.java (original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConstants.java Wed Nov 24 06:49:35 2010
@@ -51,6 +51,7 @@ public interface CxfConstants {
     String CAMEL_CXF_RS_EXTRACT_ENTITY = "CamelCxfRsExtractEntity";
     String CAMEL_CXF_RS_OPERATION_RESOURCE_INFO_STACK = "CamelCxfRsOperationResourceInfoStack";
     String CAMEL_CXF_ATTACHMENTS = "CamelAttachments";
+    String CAMEL_CXF_RS_THROW_EXCEPTION_ON_FAILURE = "CamelCxfRsThrowExceptionOnFailure";
 }
 
 

Added: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfOperationException.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfOperationException.java?rev=1038502&view=auto
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfOperationException.java (added)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfOperationException.java Wed Nov 24 06:49:35 2010
@@ -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.cxf;
+
+import java.io.Serializable;
+import java.util.Map;
+
+import org.apache.camel.CamelException;
+
+public class CxfOperationException extends CamelException implements Serializable {
+
+    private static final long serialVersionUID = 803109169584916327L;
+    private final String uri;
+    private final String redirectLocation;
+    private final int statusCode;
+    private final String statusText;
+    private final Map<String, String> responseHeaders;
+    private final String responseBody;
+
+    public CxfOperationException(String uri, int statusCode, String statusText, String location, Map<String, String> responseHeaders,
+                                 String responseBody) {
+        super("JAXRS operation failed invoking " + uri + " with statusCode: " + statusCode + (location != null ? ", redirectLocation: " + location
+            : ""));
+        this.uri = uri;
+        this.statusCode = statusCode;
+        this.statusText = statusText;
+        this.redirectLocation = location;
+        this.responseHeaders = responseHeaders;
+        this.responseBody = responseBody;
+    }
+
+    public String getRedirectLocation() {
+        return redirectLocation;
+    }
+
+    public String getResponseBody() {
+        return responseBody;
+    }
+
+    public Map<String, String> getResponseHeaders() {
+        return responseHeaders;
+    }
+
+    public int getStatusCode() {
+        return statusCode;
+    }
+
+    public String getStatusText() {
+        return statusText;
+    }
+
+    public String getUri() {
+        return uri;
+    }
+}
\ No newline at end of file

Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java?rev=1038502&r1=1038501&r2=1038502&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java (original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java Wed Nov 24 06:49:35 2010
@@ -41,51 +41,52 @@ public class CxfRsEndpoint extends Defau
     private static final Log LOG = LogFactory.getLog(CxfRsEndpoint.class);
 
     private Map<String, String> parameters;
-    private List<Class<?>> resourceClasses;    
+    private List<Class<?>> resourceClasses;
     private HeaderFilterStrategy headerFilterStrategy;
     private CxfRsBinding binding;
     private boolean httpClientAPI = true;
     private String address;
+    private boolean throwExceptionOnFailure = true;
 
     private AtomicBoolean bindingInitialized = new AtomicBoolean(false);
-    
+
     public CxfRsEndpoint(String endpointUri, CamelContext camelContext) {
         super(endpointUri, camelContext);
         setAddress(endpointUri);
     }
-    
+
     public CxfRsEndpoint(String endpointUri, Component component) {
         super(endpointUri, component);
         setAddress(endpointUri);
     }
-    
+
     // This method is for CxfRsComponent setting the EndpointUri
     protected void updateEndpointUri(String endpointUri) {
         super.setEndpointUri(endpointUri);
     }
-    
+
     public void setParameters(Map<String, String> param) {
         parameters = param;
     }
-    
+
     public Map<String, String> getParameters() {
         return parameters;
     }
-    
+
     public void setHttpClientAPI(boolean clientAPI) {
         httpClientAPI = clientAPI;
     }
-    
+
     public boolean isHttpClientAPI() {
         return httpClientAPI;
     }
-    
+
     @Override
     public boolean isLenientProperties() {
         return true;
     }
-    
-    public HeaderFilterStrategy getHeaderFilterStrategy() {    
+
+    public HeaderFilterStrategy getHeaderFilterStrategy() {
         if (headerFilterStrategy == null) {
             headerFilterStrategy = new CxfRsHeaderFilterStrategy();
             if (LOG.isDebugEnabled()) {
@@ -98,71 +99,69 @@ public class CxfRsEndpoint extends Defau
     public void setHeaderFilterStrategy(HeaderFilterStrategy strategy) {
         headerFilterStrategy = strategy;
         if (binding instanceof HeaderFilterStrategyAware) {
-            ((HeaderFilterStrategyAware)binding)
-                .setHeaderFilterStrategy(headerFilterStrategy);
+            ((HeaderFilterStrategyAware) binding).setHeaderFilterStrategy(headerFilterStrategy);
         }
     }
 
-    public Consumer createConsumer(Processor processor) throws Exception {        
+    public Consumer createConsumer(Processor processor) throws Exception {
         return new CxfRsConsumer(this, processor);
     }
 
-    public Producer createProducer() throws Exception {        
+    public Producer createProducer() throws Exception {
         return new CxfRsProducer(this);
     }
 
-    public boolean isSingleton() {        
+    public boolean isSingleton() {
         return false;
     }
-    
+
     public void setBinding(CxfRsBinding binding) {
         this.binding = binding;
         bindingInitialized.set(false);
-
     }
-    
+
     public synchronized CxfRsBinding getBinding() {
         if (binding == null) {
             binding = new DefaultCxfRsBinding();
             if (LOG.isDebugEnabled()) {
                 LOG.debug("Create default CXF Binding " + binding);
             }
-        } 
-        
+        }
+
         if (!bindingInitialized.getAndSet(true) && binding instanceof HeaderFilterStrategyAware) {
-            ((HeaderFilterStrategyAware)binding).setHeaderFilterStrategy(getHeaderFilterStrategy());
+            ((HeaderFilterStrategyAware) binding).setHeaderFilterStrategy(getHeaderFilterStrategy());
         }
-        
+
         return binding;
     }
-    
-    protected void setupJAXRSServerFactoryBean(JAXRSServerFactoryBean sfb) {        
+
+    protected void setupJAXRSServerFactoryBean(JAXRSServerFactoryBean sfb) {
         // address
         sfb.setAddress(getAddress());
         sfb.setResourceClasses(CastUtils.cast(getResourceClasses(), Class.class));
         sfb.setStart(false);
     }
-    
-    protected void setupJAXRSClientFactoryBean(JAXRSClientFactoryBean cfb) {        
+
+    protected void setupJAXRSClientFactoryBean(JAXRSClientFactoryBean cfb) {
         // address
         cfb.setAddress(getAddress());
         if (getResourceClasses() != null) {
             cfb.setResourceClass(getResourceClasses().get(0));
-        }    
+        }
     }
-   
+
     public JAXRSServerFactoryBean createJAXRSServerFactoryBean() {
-        JAXRSServerFactoryBean answer = new SpringJAXRSServerFactoryBean();        
+        JAXRSServerFactoryBean answer = new SpringJAXRSServerFactoryBean();
         setupJAXRSServerFactoryBean(answer);
         return answer;
     }
-    
+
     public JAXRSClientFactoryBean createJAXRSClientFactoryBean() {
         JAXRSClientFactoryBean answer = new SpringJAXRSClientFactoryBean();
         setupJAXRSClientFactoryBean(answer);
         return answer;
     }
-       
+
     public List<Class<?>> getResourceClasses() {
         return resourceClasses;
     }
@@ -183,4 +182,11 @@ public class CxfRsEndpoint extends Defau
         return address;
     }
 
+    public boolean isThrowExceptionOnFailure() {
+        return throwExceptionOnFailure;
+    }
+
+    public void setThrowExceptionOnFailure(boolean throwExceptionOnFailure) {
+        this.throwExceptionOnFailure = throwExceptionOnFailure;
+    }
 }

Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java?rev=1038502&r1=1038501&r2=1038502&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java (original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java Wed Nov 24 06:49:35 2010
@@ -20,15 +20,16 @@ import java.lang.reflect.Method;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-
 import javax.ws.rs.core.Response;
 
 import org.apache.camel.CamelException;
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
 import org.apache.camel.component.cxf.CxfConstants;
+import org.apache.camel.component.cxf.CxfOperationException;
 import org.apache.camel.impl.DefaultProducer;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -38,18 +39,20 @@ import org.apache.cxf.jaxrs.client.JAXRS
 import org.apache.cxf.jaxrs.client.WebClient;
 
 /**
- * CxfRsProducer binds a Camel exchange to a CXF exchange, acts as a CXF 
+ * CxfRsProducer binds a Camel exchange to a CXF exchange, acts as a CXF
  * JAXRS client, it will turn the normal Object invocation to a RESTful request
- * according to resource annotation.  Any response will be bound to Camel exchange. 
+ * according to resource annotation.  Any response will be bound to Camel exchange.
  */
 public class CxfRsProducer extends DefaultProducer {
-    
+
     private static final Log LOG = LogFactory.getLog(CxfRsProducer.class);
 
     JAXRSClientFactoryBean cfb;
+    private boolean throwException;
 
     public CxfRsProducer(CxfRsEndpoint endpoint) {
         super(endpoint);
+        this.throwException = endpoint.isThrowExceptionOnFailure();
         cfb = endpoint.createJAXRSClientFactoryBean();
     }
 
@@ -57,52 +60,52 @@ public class CxfRsProducer extends Defau
         if (LOG.isTraceEnabled()) {
             LOG.trace("Process exchange: " + exchange);
         }
-        
+
         Message inMessage = exchange.getIn();
         Boolean httpClientAPI = inMessage.getHeader(CxfConstants.CAMEL_CXF_RS_USING_HTTP_API, Boolean.class);
         // set the value with endpoint's option
         if (httpClientAPI == null) {
-            httpClientAPI = ((CxfRsEndpoint)getEndpoint()).isHttpClientAPI();
+            httpClientAPI = ((CxfRsEndpoint) getEndpoint()).isHttpClientAPI();
         }
         if (httpClientAPI.booleanValue()) {
             invokeHttpClient(exchange);
         } else {
-            invokeProxyClient(exchange);            
+            invokeProxyClient(exchange);
         }
     }
-    
+
     @SuppressWarnings("unchecked")
     protected void invokeHttpClient(Exchange exchange) throws Exception {
-        Message inMessage = exchange.getIn();       
-        WebClient client = cfb.createWebClient();        
+        Message inMessage = exchange.getIn();
+        WebClient client = cfb.createWebClient();
         String httpMethod = inMessage.getHeader(Exchange.HTTP_METHOD, String.class);
         Class responseClass = inMessage.getHeader(CxfConstants.CAMEL_CXF_RS_RESPONSE_CLASS, Class.class);
         Type genericType = inMessage.getHeader(CxfConstants.CAMEL_CXF_RS_RESPONSE_GENERIC_TYPE, Type.class);
         String path = inMessage.getHeader(Exchange.HTTP_PATH, String.class);
-       
+
         if (LOG.isTraceEnabled()) {
             LOG.trace("HTTP method = " + httpMethod);
             LOG.trace("path = " + path);
             LOG.trace("responseClass = " + responseClass);
         }
-        
+
         // set the path
         if (path != null) {
             client.path(path);
         }
-        
-        CxfRsEndpoint cxfRsEndpoint = (CxfRsEndpoint)getEndpoint();
+
+        CxfRsEndpoint cxfRsEndpoint = (CxfRsEndpoint) getEndpoint();
         // check if there is a query map in the message header
         Map<String, String> maps = inMessage.getHeader(CxfConstants.CAMEL_CXF_RS_QUERY_MAP, Map.class);
-        if (maps == null) {            
+        if (maps == null) {
             maps = cxfRsEndpoint.getParameters();
         }
         if (maps != null) {
             for (Map.Entry<String, String> entry : maps.entrySet()) {
                 client.query(entry.getKey(), entry.getValue());
-            }            
+            }
         }
-        
+
         CxfRsBinding binding = cxfRsEndpoint.getBinding();
 
         // set the body
@@ -114,32 +117,42 @@ public class CxfRsProducer extends Defau
                 LOG.trace("Request body = " + body);
             }
         }
-        
+
         // set headers
-        client.headers(binding.bindCamelHeadersToRequestHeaders(inMessage.getHeaders(),
-                                                                exchange));
-        
+        client.headers(binding.bindCamelHeadersToRequestHeaders(inMessage.getHeaders(), exchange));
+
         // invoke the client
         Object response = null;
         if (responseClass == null || Response.class.equals(responseClass)) {
             response = client.invoke(httpMethod, body);
-        } else if (Collection.class.isAssignableFrom(responseClass)) {
-            if (genericType instanceof ParameterizedType) {
-                // Get the collection member type first
-                Type[] actualTypeArguments = ((ParameterizedType) genericType).getActualTypeArguments();
-                response = client.invokeAndGetCollection(httpMethod, body, (Class)actualTypeArguments[0]);
+        } else {
+            if (Collection.class.isAssignableFrom(responseClass)) {
+                if (genericType instanceof ParameterizedType) {
+                    // Get the collection member type first
+                    Type[] actualTypeArguments = ((ParameterizedType) genericType).getActualTypeArguments();
+                    response = client.invokeAndGetCollection(httpMethod, body, (Class) actualTypeArguments[0]);
+                } else {
+                    throw new CamelException("Can't find the Collection member type");
+                }
             } else {
-                throw new CamelException("Can't find the Collection member type");
+                response = client.invoke(httpMethod, body, responseClass);
+            }
+        }
+        //Throw exception on a response > 207
+        //http://en.wikipedia.org/wiki/List_of_HTTP_status_codes
+        if (throwException) {
+            if (response instanceof Response) {
+                Integer respCode = ((Response) response).getStatus();
+                if (respCode > 207) {
+                    throw populateCxfRsProducerException(exchange, (Response) response, respCode);
+                }
             }
-        } else {
-            response = client.invoke(httpMethod, body, responseClass);
         }
-        
         // set response
-        if (exchange.getPattern().isOutCapable()) {     
+        if (exchange.getPattern().isOutCapable()) {
             if (LOG.isTraceEnabled()) {
                 LOG.trace("Response body = " + response);
-            }            
+            }
             exchange.getOut().setBody(binding.bindResponseToCamelBody(response, exchange));
             exchange.getOut().setHeaders(binding.bindResponseHeadersToCamelHeaders(response, exchange));
         }
@@ -154,7 +167,7 @@ public class CxfRsProducer extends Defau
             target = cfb.create();
         } else {
             target = cfb.createWithValues(varValues);
-        }    
+        }
         // find out the method which we want to invoke
         JAXRSServiceFactoryBean sfb = cfb.getServiceFactory();
         sfb.getResourceClasses();
@@ -164,12 +177,21 @@ public class CxfRsProducer extends Defau
         // Will send out the message to
         // Need to deal with the sub resource class
         Object response = method.invoke(target, parameters);
+
+        if (throwException) {
+            if (response instanceof Response) {
+                Integer respCode = ((Response) response).getStatus();
+                if (respCode > 207) {
+                    throw populateCxfRsProducerException(exchange, (Response) response, respCode);
+                }
+            }
+        }
         if (exchange.getPattern().isOutCapable()) {
             exchange.getOut().setBody(response);
         }
     }
 
-    private Method findRightMethod(List<Class<?>> resourceClasses, String methodName, Class[] parameterTypes) throws NoSuchMethodException {        
+    private Method findRightMethod(List<Class<?>> resourceClasses, String methodName, Class[] parameterTypes) throws NoSuchMethodException {
         Method answer = null;
         for (Class<?> clazz : resourceClasses) {
             try {
@@ -183,11 +205,9 @@ public class CxfRsProducer extends Defau
                 return answer;
             }
         }
-        throw new NoSuchMethodException("Can find the method " + methodName 
-            + "withe these parameter " + arrayToString(parameterTypes));
+        throw new NoSuchMethodException("Can find the method " + methodName + "withe these parameter " + arrayToString(parameterTypes));
     }
-    
-    
+
     private Class<?>[] getParameterTypes(Object[] objects) {
         Class<?>[] answer = new Class[objects.length];
         int i = 0;
@@ -197,7 +217,7 @@ public class CxfRsProducer extends Defau
         }
         return answer;
     }
-    
+
     private String arrayToString(Object[] array) {
         StringBuilder buffer = new StringBuilder("[");
         for (Object obj : array) {
@@ -210,4 +230,44 @@ public class CxfRsProducer extends Defau
         return buffer.toString();
     }
 
+    protected CxfOperationException populateCxfRsProducerException(Exchange exchange, Response response, int responseCode) {
+        CxfOperationException exception;
+        String uri = exchange.getFromEndpoint().getEndpointUri();
+        String statusText = Response.Status.fromStatusCode(responseCode).toString();
+        Map<String, String> headers = parseResponseHeaders(response, exchange);
+        String copy = response.toString();
+        LOG.warn(headers);
+        if (responseCode >= 300 && responseCode < 400) {
+            String redirectLocation;
+            if (response.getMetadata().getFirst("Location") != null) {
+                redirectLocation = response.getMetadata().getFirst("location").toString();
+                exception = new CxfOperationException(uri, responseCode, statusText, redirectLocation, headers, copy);
+            } else {
+                //no redirect location
+                exception = new CxfOperationException(uri, responseCode, statusText, null, headers, copy);
+            }
+        } else {
+            //internal server error(error code 500)
+            exception = new CxfOperationException(uri, responseCode, statusText, null, headers, copy);
+        }
+
+        return exception;
+    }
+
+    protected Map<String, String> parseResponseHeaders(Object response, Exchange camelExchange) {
+
+        Map<String, String> answer = new HashMap<String, String>();
+        if (response instanceof Response) {
+
+            for (Map.Entry<String, List<Object>> entry : ((Response) response).getMetadata().entrySet()) {
+                if (LOG.isTraceEnabled()) {
+                    LOG.trace("Parse external header " + entry.getKey() + "=" + entry.getValue());
+                }
+                LOG.info("Parse external header " + entry.getKey() + "=" + entry.getValue());
+                answer.put(entry.getKey(), entry.getValue().get(0).toString());
+            }
+        }
+
+        return answer;
+    }
 }

Added: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfOperationExceptionTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfOperationExceptionTest.java?rev=1038502&view=auto
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfOperationExceptionTest.java (added)
+++ camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfOperationExceptionTest.java Wed Nov 24 06:49:35 2010
@@ -0,0 +1,60 @@
+/**
+ * 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.cxf.jaxrs;
+
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.Exchange;
+import org.apache.camel.component.cxf.jaxrs.testbean.Customer;
+import org.apache.camel.test.junit4.CamelSpringTestSupport;
+import org.junit.Test;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class CxfOperationExceptionTest extends CamelSpringTestSupport {
+
+    @Override
+    protected AbstractXmlApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml");
+    }
+
+    @Test(expected = CamelExecutionException.class)
+    public void testRestServerDirectlyAddCustomer() {
+        Customer input = new Customer();
+        input.setName("Donald Duck");
+
+        // we cannot convert directly to Customer as we need camel-jaxb
+        String response = template.requestBodyAndHeader("cxfrs:http://localhost:9002/customerservice/customers?throwExceptionOnFailure=true", input,
+            Exchange.HTTP_METHOD, "POST", String.class);
+
+        assertNotNull(response);
+        assertTrue(response.endsWith("<name>Donald Duck</name></Customer>"));
+    }
+
+    @Test
+    public void testRestServerDirectlyAddCustomerWithExceptionsTurnedOff() {
+        Customer input = new Customer();
+        input.setName("Donald Duck");
+
+        // we cannot convert directly to Customer as we need camel-jaxb
+        String response = template.requestBodyAndHeader("cxfrs:http://localhost:9002/customerservice/customers?throwExceptionOnFailure=false", input,
+            Exchange.HTTP_METHOD, "POST", String.class);
+
+        assertNotNull(response);
+        assertTrue(response.contains("Problem accessing /customerservice/customers"));
+    }
+}

Modified: camel/trunk/components/camel-osgi/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-osgi/pom.xml?rev=1038502&r1=1038501&r2=1038502&view=diff
==============================================================================
--- camel/trunk/components/camel-osgi/pom.xml (original)
+++ camel/trunk/components/camel-osgi/pom.xml Wed Nov 24 06:49:35 2010
@@ -94,6 +94,7 @@
   </dependencies>
 
   <repositories>
+   <!--
     <repository>
       <id>java.net</id>
       <name>java.net Maven Repository</name>
@@ -106,6 +107,7 @@
         <enabled>false</enabled>
       </snapshots>
     </repository>
+    -->
     <repository>
       <id>spring.external.bundle.repo</id>
       <name>SpringSource Enterprise Bundle Repository - External Bundle Releases</name>

Modified: camel/trunk/components/camel-spring/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/pom.xml?rev=1038502&r1=1038501&r2=1038502&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/pom.xml (original)
+++ camel/trunk/components/camel-spring/pom.xml Wed Nov 24 06:49:35 2010
@@ -208,14 +208,14 @@
   </dependencies>
 
   <repositories>
-    <!-- for maven jaxb plugin -->
+    <!-- for maven jaxb plugin
     <repository>
       <id>java.net</id>
       <name>java.net Maven Repository</name>
       <url>http://download.java.net/maven/1</url>
-      <!--<url>https://maven-repository.dev.java.net/nonav/repository</url>-->
       <layout>legacy</layout>
     </repository>
+    -->
   </repositories>
 
   <pluginRepositories>

Modified: camel/trunk/components/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/pom.xml?rev=1038502&r1=1038501&r2=1038502&view=diff
==============================================================================
--- camel/trunk/components/pom.xml (original)
+++ camel/trunk/components/pom.xml Wed Nov 24 06:49:35 2010
@@ -80,7 +80,9 @@
     <module>camel-lucene</module>
     <module>camel-mail</module>
     <module>camel-mina</module>
+	<!--
     <module>camel-msv</module>
+	-->
     <module>camel-mvel</module>
     <module>camel-netty</module>
     <module>camel-nagios</module>
@@ -128,7 +130,9 @@
         <jdk>1.6</jdk>
       </activation>
       <modules>
+	<!--
         <module>camel-web</module>
+	-->
         <module>camel-web-standalone</module>
       </modules>
     </profile>