Author: cmoulliard
Date: Mon Jan 18 14:12:35 2010
New Revision: 900401

URL: http://svn.apache.org/viewvc?rev=900401&view=rev
Log:
Solve issue related to JSON (Json providers were not imported)

Added:
    
camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/JAXBContextResolverOSGI.java
   (with props)
Modified:
    camel/trunk/components/camel-web/pom.xml
    
camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/CamelOSGIResourceConfig.java

Modified: camel/trunk/components/camel-web/pom.xml
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-web/pom.xml?rev=900401&r1=900400&r2=900401&view=diff
==============================================================================
--- camel/trunk/components/camel-web/pom.xml (original)
+++ camel/trunk/components/camel-web/pom.xml Mon Jan 18 14:12:35 2010
@@ -587,7 +587,7 @@
                                        
com.sun.jersey.spi.container;resolution:=optional,
                                        
com.sun.jersey.spi.inject;resolution:=optional,
                                    
com.sun.jersey.spi.resource;resolution:=optional,
-                                       
com.sun.jersey.spi.spring.container.servlet;resolution:=optional
+                                       
com.sun.jersey.spi.spring.container.servlet;resolution:=optional,
                                        
com.sun.org.apache.xerces.internal.jaxp;resolution:=optional,
                                    
com.sun.research.ws.wadl;resolution:=optional,
                                    
com.sun.xml.bind.v2.ContextFactory;resolution:=optional,
@@ -651,6 +651,7 @@
                                        
WEB-INF/lib/jersey-core-1.1.5-ea-SNAPSHOT.jar,
                                        
WEB-INF/lib/jersey-server-1.1.5-ea-SNAPSHOT.jar,
                                        
WEB-INF/lib/jersey-spring-1.1.5-ea-SNAPSHOT.jar,
+                                       
WEB-INF/lib/jersey-json-1.1.5-ea-SNAPSHOT.jar,
                                        WEB-INF/tags/api
                        </osgi.classpath>
                                <osgi.private.pkg></osgi.private.pkg>
@@ -740,6 +741,52 @@
                                </dependency>
                                <dependency>
                                        <groupId>com.sun.jersey</groupId>
+                                       <artifactId>jersey-core</artifactId>
+                                       <version>${jersey-version}</version>
+                                       <exclusions>
+                                               <exclusion>
+                                                   
<groupId>org.apache.servicemix.specs</groupId>
+                                                   
<artifactId>org.apache.servicemix.specs.activation-api-1.1</artifactId>
+                                               </exclusion>
+                                               <exclusion>
+                                                   
<groupId>org.apache.servicemix.specs</groupId>
+                                                   
<artifactId>org.apache.servicemix.specs.jaxb-api-2.1</artifactId>               
                            
+                                               </exclusion>
+                                               <exclusion>
+                                                   
<groupId>org.apache.servicemix.specs</groupId>
+                                                   
<artifactId>org.apache.servicemix.specs.stax-api-1.0</artifactId>               
                            
+                                               </exclusion>
+                                               <exclusion>
+                                                   
<groupId>org.apache.servicemix.bundles</groupId>
+                                                   
<artifactId>org.apache.servicemix.bundles.jaxb-impl</artifactId>                
                                    
+                                               </exclusion>
+                                       </exclusions>
+                               </dependency>
+                               <dependency>
+                                       <groupId>com.sun.jersey</groupId>
+                                       <artifactId>jersey-server</artifactId>
+                                       <version>${jersey-version}</version>
+                                       <exclusions>
+                                               <exclusion>
+                                                   
<groupId>org.apache.servicemix.specs</groupId>
+                                                   
<artifactId>org.apache.servicemix.specs.activation-api-1.1</artifactId>
+                                               </exclusion>
+                                               <exclusion>
+                                                   
<groupId>org.apache.servicemix.specs</groupId>
+                                                   
<artifactId>org.apache.servicemix.specs.jaxb-api-2.1</artifactId>               
                            
+                                               </exclusion>
+                                               <exclusion>
+                                                   
<groupId>org.apache.servicemix.specs</groupId>
+                                                   
<artifactId>org.apache.servicemix.specs.stax-api-1.0</artifactId>               
                            
+                                               </exclusion>
+                                               <exclusion>
+                                                   
<groupId>org.apache.servicemix.bundles</groupId>
+                                                   
<artifactId>org.apache.servicemix.bundles.jaxb-impl</artifactId>                
                                    
+                                               </exclusion>
+                                       </exclusions>
+                               </dependency>
+                       <dependency>
+                                       <groupId>com.sun.jersey</groupId>
                                        <artifactId>jersey-json</artifactId>
                                        <version>${jersey-version}</version>
                                        <exclusions>

Modified: 
camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/CamelOSGIResourceConfig.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/CamelOSGIResourceConfig.java?rev=900401&r1=900400&r2=900401&view=diff
==============================================================================
--- 
camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/CamelOSGIResourceConfig.java
 (original)
+++ 
camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/CamelOSGIResourceConfig.java
 Mon Jan 18 14:12:35 2010
@@ -63,7 +63,7 @@
                RouteResource.class.getName(),
                RoutesResource.class.getName(),
                RouteStatusResource.class.getName(),
-               JAXBContextResolver.class.getName(),
+               JAXBContextResolverOSGI.class.getName(),
                JAXBMarshallerResolver.class.getName()
         };
 

Added: 
camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/JAXBContextResolverOSGI.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/JAXBContextResolverOSGI.java?rev=900401&view=auto
==============================================================================
--- 
camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/JAXBContextResolverOSGI.java
 (added)
+++ 
camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/JAXBContextResolverOSGI.java
 Mon Jan 18 14:12:35 2010
@@ -0,0 +1,71 @@
+/**
+ * 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.web.util;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import com.sun.jersey.api.json.JSONConfiguration;
+import com.sun.jersey.api.json.JSONJAXBContext;
+
+import javax.ws.rs.ext.ContextResolver;
+import javax.ws.rs.ext.Provider;
+import javax.xml.bind.JAXBContext;
+
+import org.apache.camel.web.model.Camel;
+import org.apache.camel.web.model.EndpointLink;
+import org.apache.camel.web.model.Endpoints;
+
+/**
+ * A resolver of the JAXB context OSGI primed for the Camel XML languages
+ * which supports JSON as well as XML encoding
+ *
+ * @version $Revision: 892691 $
+ */
+...@provider
+public final class JAXBContextResolverOSGI implements 
ContextResolver<JAXBContext> {
+    private final JAXBContext context;
+    private String packages;
+    
+    public JAXBContextResolverOSGI() throws Exception {
+        this.packages = org.apache.camel.web.resources.Constants.JAXB_PACKAGES;
+        this.context = new JSONJAXBContext( 
JSONConfiguration.natural().build(), this.packages );
+        
+    }
+    
+    public JAXBContext getContext(Class objectType) {
+        Package aPackage = objectType.getPackage();
+        if (aPackage != null) {
+            String name = aPackage.getName();
+            if (name.length() > 0) {
+                if (packages.contains(name)) {
+                    return context;
+                }
+            }
+        }
+        return null;
+    }
+
+    public String getPackages() {
+        return packages;
+    }
+
+    public JAXBContext getContext() {
+        return context;
+    }
+}

Propchange: 
camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/util/JAXBContextResolverOSGI.java
------------------------------------------------------------------------------
    svn:eol-style = native


Reply via email to