Author: keith
Date: Tue Jun 24 22:10:07 2008
New Revision: 18609
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=18609

Log:
Fixing Mashup-872


Modified:
   
trunk/mashup/java/modules/hostobjects/src/org/wso2/mashup/hostobjects/feed/FeedReader.java

Modified: 
trunk/mashup/java/modules/hostobjects/src/org/wso2/mashup/hostobjects/feed/FeedReader.java
URL: 
http://wso2.org/svn/browse/wso2/trunk/mashup/java/modules/hostobjects/src/org/wso2/mashup/hostobjects/feed/FeedReader.java?rev=18609&r1=18608&r2=18609&view=diff
==============================================================================
--- 
trunk/mashup/java/modules/hostobjects/src/org/wso2/mashup/hostobjects/feed/FeedReader.java
  (original)
+++ 
trunk/mashup/java/modules/hostobjects/src/org/wso2/mashup/hostobjects/feed/FeedReader.java
  Tue Jun 24 22:10:07 2008
@@ -27,6 +27,7 @@
 import org.apache.commons.httpclient.HttpException;
 import org.apache.commons.httpclient.HostConfiguration;
 import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
+import org.apache.commons.httpclient.cookie.CookiePolicy;
 import org.apache.commons.httpclient.protocol.ProtocolSocketFactory;
 import org.apache.commons.httpclient.protocol.Protocol;
 import org.apache.commons.httpclient.methods.GetMethod;
@@ -38,6 +39,7 @@
 import org.wso2.mashup.utils.MashupUtils;
 import org.wso2.mashup.MashupConstants;
 import org.wso2.mashup.MashupFault;
+import org.wso2.wsas.ServerConstants;
 
 import javax.net.ssl.SSLHandshakeException;
 import java.io.IOException;
@@ -102,7 +104,12 @@
                 method.setPath(targetURL.getPath());
                 method.setQueryString(targetURL.getQuery());
                 method.setRequestHeader(HTTPConstants.HEADER_HOST, 
targetURL.getHost());
-                if (feedUrl.startsWith("https")) {
+                
method.getParams().setCookiePolicy(CookiePolicy.IGNORE_COOKIES);   
+                HostConfiguration config = new HostConfiguration();
+
+                int port = targetURL.getPort();
+                String targetProtocol = targetURL.getProtocol();
+                if (ServerConstants.HTTPS_TRANSPORT.equals(targetProtocol)) {
 
                     // If the feed is on https then we have to make sure we 
set the users keystore
                     // details into httpClient when making the call so that 
all sslHandshake stuff
@@ -120,19 +127,19 @@
 
                     // Check weather the url has a port stated explicitly. If 
its not present
                     // default to 443
-                    int port = targetURL.getPort();
                     if (port == -1) {
                         port = 443;
                     }
                     Protocol protocol = new Protocol("custom-https", psf, 
port);
-                    HostConfiguration config = new HostConfiguration();
                     config.setHost(targetURL.getHost(), port, protocol);
-
-                    statusCode = httpClient.executeMethod(config, method);
                 } else {
+                    if (port == -1) {
+                        port = 80;
+                    }
                     // Execute the method.
-                    statusCode = httpClient.executeMethod(method);
+                    config.setHost(targetURL.getHost(), port, targetProtocol);
                 }
+                statusCode = httpClient.executeMethod(config, method);
 
                 if (statusCode != HttpStatus.SC_OK) {
                     throw new MashupFault("An error occured while getting the 
feed:" +

_______________________________________________
Mashup-dev mailing list
[email protected]
http://www.wso2.org/cgi-bin/mailman/listinfo/mashup-dev

Reply via email to