Skip to content

Commit

Permalink
Merge pull request #63 from blackducksoftware/ek_rest_connection_ctor
Browse files Browse the repository at this point in the history
Ek rest connection ctor
  • Loading branch information
ekerwin authored Oct 12, 2016
2 parents 287f431 + 8f47d30 commit 80cd9df
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.blackducksoftware.integration</groupId>
<artifactId>common-maven-parent</artifactId>
<version>1.1.3</version>
<version>1.1.5</version>
</parent>

<artifactId>hub-common</artifactId>
Expand All @@ -26,7 +26,7 @@
<dependency>
<groupId>com.blackducksoftware.integration</groupId>
<artifactId>integration-common</artifactId>
<version>1.0.2</version>
<version>1.0.4</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
import com.blackducksoftware.integration.hub.exception.ResourceDoesNotExistException;
import com.blackducksoftware.integration.hub.global.HubCredentials;
import com.blackducksoftware.integration.hub.global.HubProxyInfo;
import com.blackducksoftware.integration.hub.global.HubServerConfig;
import com.blackducksoftware.integration.log.IntLogger;
import com.blackducksoftware.integration.log.LogLevel;
import com.blackducksoftware.integration.util.AuthenticatorUtil;
Expand Down Expand Up @@ -100,6 +101,17 @@ public static String formatDate(final Date date) {
return sdf.format(date);
}

public RestConnection(final HubServerConfig hubServerConfig)
throws IllegalArgumentException, URISyntaxException, BDRestException, EncryptionException {
this(hubServerConfig.getHubUrl().toString());
final HubProxyInfo proxyInfo = hubServerConfig.getProxyInfo();
if (proxyInfo.shouldUseProxyForUrl(hubServerConfig.getHubUrl())) {
setProxyProperties(proxyInfo);
}
setCookies(hubServerConfig.getGlobalCredentials().getUsername(),
hubServerConfig.getGlobalCredentials().getDecryptedPassword());
}

public RestConnection(final String baseUrl) {
this.baseUrl = baseUrl;
client = createClient();
Expand Down

0 comments on commit 80cd9df

Please sign in to comment.