diff --git a/jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java b/jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java index a7e0c416..16cb7cb0 100644 --- a/jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java +++ b/jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java @@ -50,6 +50,9 @@ * The main starting point for interacting with a Jenkins server. */ public class JenkinsServer implements Closeable { + + private static final String DEFAULT_VIEW_NAME = "all"; + private final Logger LOGGER = LoggerFactory.getLogger(getClass()); /** @@ -117,6 +120,27 @@ public JenkinsVersion getVersion() { return jv; } + /** + * Get the HTTP client. + * @return client + */ + public JenkinsHttpConnection getClient() { + return client; + } + + /** + * @return the base base URL for this server; null if the URL can not be + * determined. + */ + public String getUrl() { + try { + return getView(DEFAULT_VIEW_NAME).getUrl(); + } catch (IOException e) { + // is that what we want? Or should we just throw the IOException? + return null; + } + } + /** * Get a list of all the defined jobs on the server (at the summary level) *