camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r761536 - in /camel/trunk/components: camel-atom/src/main/java/org/apache/camel/component/atom/ camel-atom/src/main/java/org/apache/camel/component/feed/ camel-atom/src/test/java/org/apache/camel/component/atom/ camel-rss/src/main/java/org/...
Date Fri, 03 Apr 2009 06:37:03 GMT
Author: davsclaus
Date: Fri Apr  3 06:37:02 2009
New Revision: 761536

URL: http://svn.apache.org/viewvc?rev=761536&view=rev
Log:
CAMEL-1496: Atom and RSS supports having URI parameteres on http/https feeds.

Modified:
    camel/trunk/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomComponent.java
    camel/trunk/components/camel-atom/src/main/java/org/apache/camel/component/feed/FeedEndpoint.java
    camel/trunk/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomProducerTest.java
    camel/trunk/components/camel-rss/src/main/java/org/apache/camel/component/rss/RssComponent.java

Modified: camel/trunk/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomComponent.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomComponent.java?rev=761536&r1=761535&r2=761536&view=diff
==============================================================================
--- camel/trunk/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomComponent.java
(original)
+++ camel/trunk/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomComponent.java
Fri Apr  3 06:37:02 2009
@@ -16,17 +16,17 @@
  */
 package org.apache.camel.component.atom;
 
+import java.net.URI;
 import java.util.Map;
 
-import org.apache.camel.Endpoint;
 import org.apache.camel.component.feed.FeedComponent;
 import org.apache.camel.component.feed.FeedEndpoint;
-import org.apache.camel.impl.DefaultComponent;
+import org.apache.camel.util.URISupport;
 
 /**
  * An <a href="http://camel.apache.org/atom.html">Atom Component</a>.
  * <p/>
- * Camel uses Apache Abdera as the Atom implementation. 
+ * Camel uses Apache Abdera as the Atom implementation.
  *
  * @version $Revision$
  */
@@ -34,6 +34,17 @@
 
     @Override
     protected FeedEndpoint createEndpoint(String uri, String remaining, Map parameters) throws
Exception {
+
+        // Parameters should be kept in the remaining path, since they might be needed to
get the actual ATOM feed
+        URI remainingUri = URISupport.createRemainingURI(new URI(remaining), parameters);
+
+        // if http or https then the uri should include the parameters as we can have URI
parameters
+        // that need to be sent to the remote server when retrieving feeds
+        String scheme = remainingUri.getScheme();
+        if (scheme != null && (scheme.equals("http") || scheme.equals("https")))
{
+            return new AtomEndpoint(uri, this, remainingUri.toString());
+        }
+
         return new AtomEndpoint(uri, this, remaining);
     }
 

Modified: camel/trunk/components/camel-atom/src/main/java/org/apache/camel/component/feed/FeedEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-atom/src/main/java/org/apache/camel/component/feed/FeedEndpoint.java?rev=761536&r1=761535&r2=761536&view=diff
==============================================================================
--- camel/trunk/components/camel-atom/src/main/java/org/apache/camel/component/feed/FeedEndpoint.java
(original)
+++ camel/trunk/components/camel-atom/src/main/java/org/apache/camel/component/feed/FeedEndpoint.java
Fri Apr  3 06:37:02 2009
@@ -180,7 +180,12 @@
     public boolean isSortEntries() {
         return sortEntries;
     }      
-    
+
+    public boolean isLenientProperties() {
+        // true to allow dynamic URI options to be configured and passed to external system
for eg. the HttpProducer
+        return true;
+    }
+
     // Implementation methods
     //-------------------------------------------------------------------------
 

Modified: camel/trunk/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomProducerTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomProducerTest.java?rev=761536&r1=761535&r2=761536&view=diff
==============================================================================
--- camel/trunk/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomProducerTest.java
(original)
+++ camel/trunk/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomProducerTest.java
Fri Apr  3 06:37:02 2009
@@ -25,7 +25,7 @@
 
     public void testNotYetImplemented() throws Exception {
         try {
-            context.getEndpoint("atom:file:target/out.atom").createProducer();
+            context.getEndpoint("atom:file://target/out.atom").createProducer();
             fail("Should have thrown an UnsupportedOperationException");
         } catch (UnsupportedOperationException e) {
             // ok

Modified: camel/trunk/components/camel-rss/src/main/java/org/apache/camel/component/rss/RssComponent.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-rss/src/main/java/org/apache/camel/component/rss/RssComponent.java?rev=761536&r1=761535&r2=761536&view=diff
==============================================================================
--- camel/trunk/components/camel-rss/src/main/java/org/apache/camel/component/rss/RssComponent.java
(original)
+++ camel/trunk/components/camel-rss/src/main/java/org/apache/camel/component/rss/RssComponent.java
Fri Apr  3 06:37:02 2009
@@ -16,10 +16,12 @@
  */
 package org.apache.camel.component.rss;
 
+import java.net.URI;
 import java.util.Map;
 
 import org.apache.camel.component.feed.FeedComponent;
 import org.apache.camel.component.feed.FeedEndpoint;
+import org.apache.camel.util.URISupport;
 
 /**
  * An <a href="http://camel.apache.org/rss.html">RSS Component</a>.
@@ -29,6 +31,15 @@
 public class RssComponent extends FeedComponent {
 
     protected FeedEndpoint createEndpoint(String uri, String remaining, Map parameters) throws
Exception {
-        return new RssEndpoint(uri, this, remaining);        
+
+        // Parameters should be kept in the remaining path, since they might be needed to
get the actual RSS feed
+        URI remainingUri = URISupport.createRemainingURI(new URI(remaining), parameters);
+
+        if(remainingUri.getScheme().equals("http") || remainingUri.getScheme().equals("https")){
+            return new RssEndpoint(uri, this, remainingUri.toString());
+        }
+
+        return new RssEndpoint(uri, this, remaining);
     }
-}
+    
+}
\ No newline at end of file



Mime
View raw message