Revision: 270 http://mindtreeinsight.svn.sourceforge.net/mindtreeinsight/?rev=270&view=rev Author: bindul Date: 2011-01-25 16:39:25 +0000 (Tue, 25 Jan 2011)
Log Message: ----------- 3165153: Properly handle HTTP filesets Modified Paths: -------------- insight/insight-ui/branches/insight-ui-1.5.0/src/main/java/com/mindtree/techworks/insight/download/DownloadProvider.java insight/insight-ui/branches/insight-ui-1.5.0/src/main/java/com/mindtree/techworks/insight/download/HTTPRemoteClient.java Modified: insight/insight-ui/branches/insight-ui-1.5.0/src/main/java/com/mindtree/techworks/insight/download/DownloadProvider.java =================================================================== --- insight/insight-ui/branches/insight-ui-1.5.0/src/main/java/com/mindtree/techworks/insight/download/DownloadProvider.java 2011-01-25 16:38:35 UTC (rev 269) +++ insight/insight-ui/branches/insight-ui-1.5.0/src/main/java/com/mindtree/techworks/insight/download/DownloadProvider.java 2011-01-25 16:39:25 UTC (rev 270) @@ -1,8 +1,8 @@ /* - * $HeadURL: $ - * $Date: $ - * $Revision: $ - * $Author: $ + * $HeadURL$ + * $Date$ + * $Revision$ + * $Author$ * * Copyright (c) 2005 MindTree Consulting Ltd. * @@ -200,7 +200,7 @@ break; case Fileset.HTTP_FILESET: try { - nodeId = new URL((String)uniqueFiles.get(count)).getHost(); + nodeId = new URL((String)files.get(count)).getHost(); } catch(MalformedURLException mfe) { // consume this } Modified: insight/insight-ui/branches/insight-ui-1.5.0/src/main/java/com/mindtree/techworks/insight/download/HTTPRemoteClient.java =================================================================== --- insight/insight-ui/branches/insight-ui-1.5.0/src/main/java/com/mindtree/techworks/insight/download/HTTPRemoteClient.java 2011-01-25 16:38:35 UTC (rev 269) +++ insight/insight-ui/branches/insight-ui-1.5.0/src/main/java/com/mindtree/techworks/insight/download/HTTPRemoteClient.java 2011-01-25 16:39:25 UTC (rev 270) @@ -1,8 +1,8 @@ /* - * $HeadURL: $ - * $Date: $ - * $Revision: $ - * $Author: $ + * $HeadURL$ + * $Date$ + * $Revision$ + * $Author$ * * Copyright (c) 2005 MindTree Consulting Ltd. * @@ -30,6 +30,7 @@ import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; +import java.net.PasswordAuthentication; import java.net.URL; import org.apache.commons.httpclient.DefaultHttpMethodRetryHandler; @@ -38,6 +39,7 @@ import org.apache.commons.httpclient.HttpException; import org.apache.commons.httpclient.HttpStatus; import org.apache.commons.httpclient.NTCredentials; +import org.apache.commons.httpclient.UsernamePasswordCredentials; import org.apache.commons.httpclient.auth.AuthScope; import org.apache.commons.httpclient.methods.GetMethod; import org.apache.commons.httpclient.params.HttpMethodParams; @@ -221,13 +223,13 @@ hostConfiguration.setProxy(httpProxyInfo.getHost(), httpProxyInfo.getPort()); - if (proxyInfo.isAuthenticationRequired()) { + if (proxyInfo.isAuthenticationRequired() && null != proxyInfo.getPasswordInformation()) { - NTCredentials credentials = getNTCredentials(proxyInfo - .getPasswordInformation().getUserName(), + PasswordAuthentication passwordAuth = proxyInfo.getPasswordInformation(); + UsernamePasswordCredentials credentials = getCredentials( + passwordAuth.getUserName(), new StringBuffer().append( - proxyInfo.getPasswordInformation() - .getPassword()).toString(), + passwordAuth.getPassword()).toString(), httpProxyInfo.getHost()); // Set the proxy credentials @@ -256,7 +258,7 @@ if (fileset.isAuthenticationRequired()) { try { URL theURL = new URL(url); - NTCredentials credentials = getNTCredentials(fileset + UsernamePasswordCredentials credentials = getCredentials(fileset .getUserName(), fileset.getPassword(), theURL.getHost()); AuthScope authScope = new AuthScope(theURL.getHost(), (theURL .getPort() == -1) ? theURL.getDefaultPort() : theURL @@ -279,7 +281,7 @@ * @return A {@link NTCredentials NTCredentials}object containing the * information. */ - private NTCredentials getNTCredentials (String user, String password, + private UsernamePasswordCredentials getCredentials (String user, String password, String host) { String domain = null; @@ -293,7 +295,11 @@ userName = userName.substring(userName.indexOf('\\') + 1); } - return new NTCredentials(userName, password, host, domain); + if (null == domain) { + return new UsernamePasswordCredentials(user, password); + } else { + return new NTCredentials(userName, password, host, domain); + } } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d _______________________________________________ MindTreeInsight-commits mailing list MindTreeInsight-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mindtreeinsight-commits